Use file/class external actionscript "Basic."

Hey all,.

I'm a little baffled by something that should, IMHO, be a piece of cake...

The installation is really easy. A simple application with a single textinput, a button and a text component.

When we click the button a function is called that sets the text of the inputfield in the text element.

Code:

<? XML version = "1.0" encoding = "utf-8"? >
" < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"> "
< mx:Script >
<! [CDATA]
public void click(inputText:String):void {}
outPutTxt.text = inputText;
}
[]] >
< / mx:Script >
< mx:TextInput x = "10" y = "10" id = "inputTxt" / >
< mx:Button = "178" x = "10" label = "Button" id = "Btn" click = "{click (inputTxt.text)}" / >
< mx:Text = '251' x y = '12' text = 'Text' id = "outPutTxt" / >
< / mx:Application >

As I said, really easy.

What I want to do is put the 'click' function in an external actionscript file or class. And be able to continue to, of in the external file, change things outPutTxt.

I am aware that I could create a public variable can be bound inside the external file and how to bind the outPutTxt to this variable, but I really wish I could 'just' forcing the value...

Is this possible? If Yes: how plix

If it is not possible, I would like to know as well! And in this case, how I can re - use the same instance of a class or a file in several separate components? I am a 'login' thingie where a user connects (data stored outside in an actionscript class/separated file) and I want to reuse the information on other pages... Or this is done automatically?

All the comments and answers are highly appreciated!

Pieter

I'm not quite clear on what exactly you are trying to achieve, but here's what I got:

There are several ways to separate things like that, but I'll write two of them

(1) If you put the function externally as a file, not a class, you just simply includethat as file in this mxml and you're nothing extra is needed

(2) If you have an external class

for example myclass you do next:

MyClass {}

public void click(inputText:String):void {}
This ["outPutTxt"] .text = inputText;
}

}

then in your mxml:


http://www.Adobe.com/2006/mxml"layout ="absolute">
   
        

private var myClassInstance:MyClass = new MyClass(); / / or isntantiate just as you wish, in creationCompete etc,...

]]>
   
   
   
   

have not tested, but should work.

on the sidenote: I'm not sure why would you need to do, if specify you your question could be useful.

Tags: Flex

Similar Questions

  • urlLoader - replace it with the File class to access external resources

    Hello.

    Just read up on the File class more than anything because I want to develop on mobile devices. Can I replace all my classes urlLoader with the File class for my games on the web.

    var prefsFile:File = File.applicationDirectory;

    prefsFile = prefsFile.resolvePath ("preferences.xml");

    I feel that it is perhaps a silly question, but I have to ask.

    See you soon

    Yes, but you probably don't want to use applicationDirectory because of security concerns.

    and is there a reason you can't use your urlloaders?

  • Using the file class - muse. by default on my computer and not the last used folder.

    Using the file class - muse by default to my computer and not to the last used folder.

    Hello Perri,

    I tested on my end, and it seems that the issue is ongoing because of Air Version 3.8 was last updated. If restore you the version of Air to 3.7 this problem would be fixed.

    Here is the link to the page for the available versions of Adobe Air: http://helpx.adobe.com/air/kb/archived-air-sdk-version.html and you can use this link to download Adobe Air version 3.7:
    http://download.Macromedia.com/air/Win/Download/3.7/AdobeAIRInstaller.exe (Windows)

    http://download.Macromedia.com/air/Mac/download/3.7/AdobeAIR.dmg (Mac)

    Hope this information helps.

    Kind regards

    Fox

  • Using the class Tween w / dynamic text

    Hi all

    I feel sort of my way along here. I'm certainly not an expert in what I'm looking for.

    I created a small flash animation that imports data from an XML file into different six fields of text and one image. It works wonder.

    However, the customer would be as a kind of animation on the text so it fade, scaling, color changing, movement... whatever. I've only used the class tween once but that sounds like the way to go (I think...?).

    I'm stuck. I've been searching the Net and I can't seem to make sense what I read when it comes to use the Tween class with dynamic text.

    I enclose my actionscript.

    Can someone point me in the right direction?

    Thank you!!

    Nevermind, I think I found what I needed. Thank you guys!

  • How can I keep IE and FireFox Favorites in local sync to my PC only, without the use of an external server or import/export?

    FireFox Sync is not an option, because the use of an external server is not allowed.
    Use of third-party modules is not really an option.
    Import/export is inefficient because it is not put them in the same exact place in every browser.

    I am happy to be able to use the same favorites/bookmarks file if it is an option.

    Thank you

    You do not have.

    Sorry, IE and Firefox use different methods of storage Favorites / Bookmarks to data that are not compatible with the other program.

  • Should what format I use for my external hard drive?

    I have an external drive that I wish I could use (writing) from my Mac and my PC, but without the limitations of + 4 GB files.

    Is this possible or am I pasted with limiting the size? If so should what format I use on my external hard drive? and it has all the other notes aside I should know?

    Thank you!

    Hi Filabaca:

    If you want to use a hard drive external Mac and PC options are:

    1. format the drive in Mac as exFat

    2. format the drive to NTFS on a Windows PC and use a program like Paragon NTFS for Mac. https://www.Paragon-Software.com/home/NTFS-Mac/

    Paragon NTFS for Mac allows you to use a disc formatted in NTFS by a Windows PC.

    Here is an article showing the difference between FAT32, exFAT and NTFS. http://www.howtogeek.com/235596/whats-the-difference-between-fat32-exfat-and-ntf s /

    Kim

  • The CCleaner registry cleaner reports "invalid or empty the file class."

    Original title: when using CCleaner (cleaning the registry), the only problem that arises is; 'Class file invalid or empty', how can I solve this problem?

    After using CCleaner, registry cleaner, CCleaner is displayed the following problem;

    Problem: Invalid or empty the file class

    Data:.tif\openWithProgids\MSPaper.Document

    Registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\fileExts\.tif\OpenWithProgids

    How can I solve this problem once and for all?

    When I use 'Registry Cleaner' "CCleaner" from the program for "chose to solve problems", it doesn't permanently solves the problem, as whenever I run the CCleaner program at a later date, it is here once again!

    I have the 32-bit version of Windows XP service pack 3 and Windows Explorer 8, is installed on this desktop computer.

    Please, help me to solve this problem.

    Thank you for any help you can give me!

    The problem with registry cleaners in general is that they often report "of the problems' when there is no problem.  If the user actually deletes an entry from the registry in response to such a notice, then it could well be a problem.

    Just because you have not known - again - a problem with the Ccleaner registry cleaning tool does not mean that you won't.  Because the 'cleansing' of the registry has not been shown to have an effect on the performance of the system, the risk of deleting something important makes use of stupid registry cleaners.  Read the two links in my previous post.

    As I wrote originally, the 'problem' reported by Ccleaner is probably due to his inability to properly manage the data type "REG_NONE" in the registry key.

    The way to fix this is to ignore and stop using Ccleaner registry that tells you that there is a 'problem '.

  • I need help with the use of Class.forName and getResourceAsStream

    I am trying to write code that will play an audio file. All references I found the point of code as follows...

                              Class dir = Class.forName("lib.testother");
                                InputStream input = dir.getResourceAsStream("/explosion.aac");
                                Player player =
                                    javax.microedition.media.Manager.createPlayer(input, "audio/aac");
                                player.realize();
                                VolumeControl vol = getVolumeControl(player);
                                if (vol != null)
                                {
                                    int volume = vol.getLevel();
                                    vol.setLevel(volume);
                                }
                                player.prefetch();
                                player.start();
    

    I use Blackberry JDE. Now, I'm supposed to put the audio file of the project?

    Second, how then use the class.forName function? I put the audio file as a member of the project and then tried the above code and I get that it can not find lib.testother (which is the path of the code).

    If I use getClass() instead of dir above, getResourceAsStream returns null.

    Are there examples of the use of these or how to include the audio in your project... from end-to-end. The code snippet above is all I could find and it isn't enough.

    THX

    D

    Check this thread:

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=11616&query.ID=18...

  • Ablet o not copy paste any file to external/usb drives.

    Hello

    I am using the Windows 7 operating system but since this morning I am not able to copy paste any file from the laptop external drives, nor able to delete files from external hard drives / flash drives. But I can easily copy paste any file internally to laptop readers.

    Check the permissions of reading and writing for readers.

    Error returned is "requirement authority administrator to perform this task". Have two users for my operating system.

    (1) Director

    (2) myself.

    Please help, because I don't want to format the system.

    Thank you

    Amit

    Hi Amit,

    1. were there any changes (hardware or software) to the computer before the show?

    2. don't you insert disk/Flash external to the other computer or other computer ports readers?

    3. are you able to copy the contents of the external hard drive to the laptop?

    Gives Permission to the external drive and see if the error resolves.

    a: Connect the external drive .
    b:
    click on computer / my computer
    c: Click on your external hard drive
    d: Right-click and select properties of
    e:
    click on Security
    f: Check that your username has the reading and writing for the reader

    Answer please if you have any questions.

  • Problem with the use of the external hard drive.

    I was using a disk external hard seagate to store pictures. All of a sudden, it wants me to format the drive. If I do this, will erase all my photos? Is anyway around that I wouldn't lose thousands of photos.

    On Sunday, August 3, 2014 20:49:55 + 0000, CEDGR1208 wrote:

    I was using a disk external hard seagate to store pictures. All of a sudden, it wants me to format the drive. If I do this, will erase all my photos? Is anyway around that I wouldn't lose thousands of photos.

    See Zigzag3143 answer you and I would add the following:

    If you have only one copy of all the files that are important to you,
    whether on an internal hard drive, external drive, or anywhere else, you
    are always in danger of losing. It is always possible that a hard
    car accident, near Thunderbolt, user error, virus, attack the same
    stolen computer, can result in the loss of everything on your drive.
    As it has often been said, it is not a question of whether you'll
    such a problem, but when.

    I hope you succeed to save your photos, but for the future, be
    of course, you always have a backup of these and any other
    important files on external media.

  • All files on external Synology is not found

    Hi guys, I'm not an expert but had been using L6 for a few months and after 2 weeks I wanted to access my files on external Synology but all the files in the module development of break is not found. Strange to me is that in the library, everything seems ok - connection for external hard drive is ok, not smoker of question marks on the folder or files. I can also access Synology from the Finder.

    I had an experience - is installed directly in Lightroom a local folder (on my MacBook) Synology and once he was moved again, I was not able to find these files in the develop module, but again, see the moved folder and the previous file.

    I'm completely confused... running El Captian on MacBook Pro.

    Please help... Thank you!

    Hello! Looks like I've found the bug - the name of the shared folder on the Synology has been notably Polish letter that confuses the relationship between Lightroom and Synology.
    Only, I wonder how it worked before... perhapse Synology update caused the problem.

    PS. I have the almost the same configuration with 2 TB WD red 3

  • Problem contacting class MXML ActionScript catch block

    Whenever there is an exception inside the ActionScript class, I want to access the TextInputId MXML and displays an Error Message on it, but I am unable to succeed.

    This is the code I am using

    < mx:Application >

    < mx:TextInput id = "Myti(nose)" / >

    < / mx:Application >


    The class inside ActionScript:

    catch(Error:Error)
    {

    Application.application.MyTI.text = "Data Error"
    }

    Need your suggestions to this implementation.
    Thanks in advance

    Hi Kiran,

    There should defenitely wor for you...

    Try to debug and check if the control is entering the catch block.

    Thank you

    Jean Claude Chari

  • How to use a class in Flash

    I am trying to use a class (LoadSwf.as) in Flash. The code is listed below. Here is my code in Flash:
    import LoadSwf
    var myLoader:LoadSwf = new LoadSwf()
    addChild (myLoader)

    The imported file (Login1.swf) contains a very simple ComboBox. When it is loaded into Flash ComboBox fails. Why is this happening? Thank you!

    I think you should add the loader to the display list when the loader is complete:

  • Firefox crashes after the stopcock, told to use: file &gt; exit but there is no help

    FF has re - opened on the same web page that I finally visited during my last visit internet. Use: file > exit, as suggested is no help.
    Yes, I have the new version of FF. I use Windows XP with pack Svc. 3.
    Yes I have clear cache and cookies every day.
    NO I don't have any viruses, malware, trojans, etc...

    In the Options window > general > Startup > scrollbar when Firefox starts and select Show my home page , click OK to save, exit firefox and start it again.

    For more information, see: window Options - general Board

    Thank you

    Please check 'Resolved' the answer really solve the problem, to help others with a similar problem.

  • What will be the form of the file (file://) Protocol in firefox? Using file://servername/foldername, I am uable to open a folder. But she supported in other browsers. Need a quick solution to this issue.

    What will be the form of the file (file://) Protocol in firefox? Using file://servername/foldername, I am uable to open a folder. But it

    supported in other browsers. Need a quick solution to this issue.
    I used following code snippets:
    < a href = "file://PC2/c$" > open the file < /a >
    It is used to open C: /. But it does not work in other browsers except Mozilla.

    Need a solution as soon as possible...

    See also:

Maybe you are looking for