Assigning a variable name to a text field

You can associate dynamic and input text fields with an ActionScript variable name, which lets you get or set the contents of the text using ActionScript.

To associate a variable name with a dynamic or input text field:

  1. Create a new document from the Flash Lite 1.1 Symbian Series 60 template and save it as dynamic_text.fla.

    For more information about using Flash Lite document templates, see Using Flash Lite document templates in Getting Started with Flash Lite 1.x.

  2. Create a dynamic or input text field on the Stage, and select it.
  3. In the Property inspector, in the Var text box, type nameVar.

    The value that you enter must be a valid variable identifier--the first character must be a letter, underscore (_), or dollar sign ($), and each subsequent character must be a letter, number, underscore, or dollar sign.



  4. In the Timeline, select Frame 1 on the layer named ActionScript.
  5. Open the Actions panel (Window > Actions) and enter the following code:
    nameVar = "George Washington"
    
  6. Test the application in the Adobe Device Central emulator (Control > Test Movie).

For another example of using dynamic text fields, see Text field example application.


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00005657.html