View Actionscript For The Dynamic Text Field; Test The Swf File - MACROMEDIA FLASH 8-FLASH Tutorials Manual

Hide thumbs Also See for FLASH 8-FLASH:
Table of Contents

Advertisement

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 > Actions, or press F9.
The ActionScript appears as follows:
// Load text as variable and assign it to the
// dynamic text field
var features_lv:LoadVars = new LoadVars();
features_lv.onLoad = onText;
features_lv.load("safetyfeatures.txt");
function onText(success:Boolean) {
if (success) {
newFeatures_txt.text = features_lv.safetyfeatures;
} else {
newFeatures_txt.text = "unable to load text file.";
}
}
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.
Test the SWF file 207

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-FLASH and is the answer not in the manual?

Table of Contents

Save PDF