Test the SWF file
83
Specify format options
The Format Options dialog box allows you to specify margin and indentation settings for
the text.
1.
With the dynamic text field still selected on the Stage, click Format in the Property inspector.
2.
In the Left Margin text box, enter
5
, and in the Right Margin text box, enter
5
. Then click OK.
The dynamic text now has 5-pixel left and right margins within the text field.
View ActionScript for the dynamic text field
You can view the ActionScript that loads text from the external text file into the dynamic text
field. This script uses LoadVars actions to load the safetyfeatures.txt content in the newFeatures
text field.
1.
In the Timeline, select Frame 1 of the Actions layer.
2.
Select Window > Development Panels > Actions, or press F9.
The ActionScript appears as follows:
// Load text as variable and assign it to dynamic text field
Features_lv = new LoadVars();
Features_lv.onLoad = onText;
Features_lv.load("safetyfeatures.txt");
function onText() {
newFeatures_txt.text = Features_lv.safetyFeatures;
}
3.
Close the Actions panel.
Test the SWF file
Save and test the document to ensure that the dynamic text loads correctly.
1.
Select File > Save; then select Control > Test Movie.
In the SWF file window, text from the external text file should appear in the dynamic text field
that you created. (If the text does not appear as expected, check that you entered the instance
name correctly: newFeatures_txt. Also check that you saved your copy of the practice file in the
same folder as the original text_start file.)
2.
Type in the input text fields.
3.
When you finish testing the file, close the SWF file window.
Summary of Contents for FLASH MX 2004-LEARNING FLASH
Page 1: ...Learning Flash...
Page 8: ...8 Contents...
Page 34: ...34 Chapter 3 Write Scripts with ActionScript...
Page 54: ...54 Chapter 6 Create a User Interface with Layout Tools...
Page 62: ...62 Chapter 7 Draw in Flash...
Page 68: ...68 Chapter 8 Create Symbols and Instances...
Page 76: ...76 Chapter 9 Add Animation and Navigation to Buttons...
Page 104: ...104 Chapter 13 Add Interactivity with ActionScript...
Page 112: ...112 Chapter 14 Create a Form with Conditional Logic and Send Data...
Page 122: ...122 Chapter 15 Work with Objects and Classes Using ActionScript 2 0...