User Guide
Controlling text with ActionScript 125
italic = false
underline = false
url = ""
target = ""
align = "left"
leftMargin = 0
rightMargin = 0
indent = 0
leading = 0
bullet = false
tabStops = [] (empty array)
To create a dynamic text field:
1.
Select a frame, button, or movie clip that will receive the action.
2.
Select Window > Development Panels > 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 method.
4.
Select the placeholder instanceName and enter an instance name or path for the movie clip 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 is the instance name of the new text field. For this example, enter myText.
■ Depth is a number that specifies the stacking order. For this example, enter 1.
■ X is the x coordinate relative to the parent clip. For this example, enter 50.
■ Y is the y coordinate relative to the parent clip. For this example, enter 50.
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
text property to create a new line. For this example, replace the placeholder instanceName
with myText in the Object parameter field.
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 myText, a depth of 1, a width of 200, a
height of 100, an x value of 50, and a y value of 50.
For a detailed description of the
createTextField method of the TextField object, see
“TextField class” in Flash ActionScript Language Reference.