Chapter 18. On-Screen Text Fields
Because Flash is fundamentally a visual environment, movies often present on-screen information to users. Similarly, because Flash is an interactive environment, movies often retrieve information from users through a GUI. To display the value of a variable on screen or to allow a user to type data into a Flash movie, we use text fields.
Text fields provide a means of both setting and retrieving the values of variables that have a visual representation. Text fields come in two varieties—dynamic text fields, which we use to display information to the user, and user-input text fields, which we use to retrieve information from the user.
Dynamic Text Fields
A dynamic text field is like a variable viewport—it displays the value of a specified variable as a text string. Dynamic text fields are created using the Text tool in Flash. However, unlike regular static text, the content of a dynamic text field is connected to a variable and can be changed or retrieved via ActionScript.
By retrieving a text field’s value, we can capture on-screen information for use in a script. By setting a text field’s value, we cause that value to display on screen.
Creating a Dynamic Text Field
To make a new dynamic text field, follow these steps:
Select the Text tool.
Click and drag a rectangle on the Stage. The outline that you create will define the size of the new text field.
Select Text → Options. The Text Options panel appears.
In the Text Type menu, choose Dynamic Text (the other ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access