Assign instance names to text fields
An input text field on the Stage is an instance of the ActionScript TextField object, to which you
can apply properties and methods. As a best practice, you should name text field instances so that
you or others working on the project can refer to the instance in ActionScript.
Select the input text field that you placed next to First Name. In the Property inspector, enter
1.
firstName_txt in the Instance Name text box.
Select the input text field that you placed next to Last Name. In the Property inspector, enter
2.
lastName_txt in the Instance Name text box.
Select the input text field that you placed next to eMail Address. In the Property inspector, enter
3.
eMail_txt in the Instance Name text box.
To learn more about the TextField object, see "Working with Text" in Using ActionScript in Flash.
Create a dynamic text field
Dynamic text can display text from external sources at runtime. Next, you'll create a dynamic text
field that links to an external text file. The external text file you'll use is named safetyFeatures.txt.
It is in the same folder as the lesson FLA file. The FLA file already contains ActionScript to
display the text when you test or publish the document.
In the Timeline, select the Dynamic Text layer. Use the Selection tool to click in the workspace,
1.
to deselect any objects.
Select the Text tool in the Tools panel.
2.
In the text Property inspector, set the following options:
3.
Select Dynamic Text from the Text Type pop-up menu.
For Text Attributes, set Verdana as the text type, with a font size of 6.
For Line Type, select Multiline to ensure the text wraps correctly.
Click the text color box and select a dark shade of gray.
Select Align Left as a paragraph attribute, if it isn't already selected.
On the Stage, drag to create a text field in the area between the two horizontal rules.
4.
In the Instance Name text box of the Property inspector, name the dynamic text field
5.
newFeatures_txt.
The ActionScript in this document loads an external text file, which is in the same folder as
your document. The ActionScript is set up to load the text into a field named newFeatures_txt.
82
Chapter 10: Add Static, Input, and Dynamic Text
Need help?
Do you have a question about the FLASH MX 2004-LEARNING FLASH and is the answer not in the manual?
Questions and answers