In the preceding sections, we learned three tools for accessing manually created symbol instances through ActionScript:
The getChildAt( ) method
The getChildByName( ) method
Automatically assigned instance variables
The same three tools can also be used to access manually created text. In the Flash authoring tool, text fields are created with the Text Tool. Manually created text fields of type Dynamic Text or Input Text are represented at runtime by instances of the flash.text.TextField class. Like symbol instances, Dynamic and Input text fields become display children of the object representing the timeline that contains them. Also like symbol instances, Dynamic and Input text fields can be assigned an instance name that corresponds to an automatically assigned instance variable.
For example, the following steps describe how to move a manually created Dynamic text field to coordinate (200, 300) using ActionScript:
In the Flash authoring tool, create a new .fla file name message.fla.
In the Tools panel, select the Text Tool.
Click the Stage of the first frame of message.fla's main timeline.
In the text field that appears, enter the text
On the Properties panel (Window → Properties), change Static Text to Dynamic Text.
Still on the Properties panel, for <Instance Name>,
Click the first frame of message.fla's main timeline (select it).
Open the Actions panel (Window → Actions).
Enter the following code into the Actions panel:
msg.x = 200; msg.y = ...