User Guide
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.