To create a dynamic text field:
1.
Select a frame, button, or movie clip that is to receive the action.
2.
Select Window > Actions to open the Actions panel if it isn't already open.
3.
In the Actions toolbox, select the Built-in Classes category, then select the Movie category,
then select the MovieClip category, and then select the Methods category. Finally, double-
click the
createTextField()
4.
Select the placeholder
that will be the parent of the new text field. For this example, enter the alias _root because
the main Timeline is the parent.
5.
Enter values for the following parameters:
Instance Name
myText.
is a number that specifies the stacking order. For this example, enter 1.
Depth
is the x coordinate relative to the parent clip. For this example, enter 50.
X
is the y coordinate relative to the parent clip. For this example, enter 50.
Y
The following code is displayed in the Script pane:
_root.createTextField("mytext",1,50,50,200,100);
6.
In the Actions toolbox, select the Built-in Classes category, then select the Movie category,
then select the TextField category, and then select the Properties category. Finally, double-
click the
property to create a new line. For this example, replace the placeholder
text
with myText in the Object parameter field.
instanceName
7.
In the Value field, enter this is my first text field object text. The following text is displayed
in the Script pane:
mytext.text = "this is my first text field object text";
This example creates a text field with an instance name
200, a height of 100, an x value of 50, and a y value of 50.
For a detailed description of the
TextField in ActionScript 2.0 Language Reference.
Setting text field properties dynamically
To use ActionScript to set the properties of a text field, you must assign the text field an
instance name. If you create the text field on the Stage with the Text tool, you can assign the
instance name in the Property inspector. If you create the text field dynamically, you can
assign an instance name as a parameter of the
method.
and enter an instance name or path for the movie clip
instanceName
is the instance name of the new text field. For this example, enter
createTextField
myText
method of the TextField object, see
method.
createTextField
Controlling text with ActionScript
, a depth of 1, a width of
185
Need help?
Do you have a question about the FLASH 8-USING FLASH and is the answer not in the manual?