Working with Text > Controlling text with ActionScript > Setting text field properties dynamically |
![]() ![]() ![]() |
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 createTextField
method.
To set text field properties dynamically:
1 |
Choose Window > Actions to open the Actions panel if it isn't already open. |
2 |
Do one of the following to create a text field: |
![]() |
Select the Text tool and draw a text field on the Stage. Assign the text field an instance name in the Property inspector. For this example, enter the instance name myText. |
![]() |
Double-click the |
3 |
Do one of the following to place text in the text field: |
![]() |
Enter text into the text field on the Stage. |
![]() |
Set the |
4 |
In the Actions toolbox, select the Objects category, then select the Movie category, then select the TextField category, then select the Property category, then double-click the |
5 |
Enter the following parameters: |
![]() |
|
![]() |
Value is the value of the property. |
6 |
Repeat step 4 for the |
mytext.multiline = true; mytext.wordWrap = true; mytext.border = true; |
For a complete list of TextField object methods and detailed descriptions of each, see the TextField object entry in the online ActionScript Dictionary in the Help menu.
![]() ![]() ![]() |