- Downloading the Example Files
- Creating your First Code Snippet
- Setting a Custom Cursor
- Setting a Source Video File
- Loading and Displaying an External Text File
- Loading and Displaying an External Image
- Linking to a URL
- Next Steps
Loading and Displaying an External Text File
Next, you will add a code snippet that will load an external text file. You will then modify the ActionScript that the snippet creates so that the loaded text displays in the TextArea component that is in the page1_mc movie clip.
- In the Actions panel, select a line below all of the existing code.
- In the Code Snippets panel, open the folder named “Load and Unload.”
- Double Click the code snippet named “Load External Text”.
- Near the bottom of the Actions panel, locate the line that reads:
- Change this line so that it reads:
- Test the movie. The loaded text should appear in the TextArea component (see Figure 4). Notice that this component automatically includes a working scrollbar for the text.
- Close the codesnippets_start.swf file to leave the Flash testing environment and return to the authoring environment.
If you tested the movie now, the text file indicated in the code snippet would load and be displayed in the Flash Output panel. You will modify the code so that it instead displays in the TextArea component named field1_txt that is contained in the page1_mc movie clip.
trace(textData);
page1_mc.field1_txt.text = textData;
The code snippet that you just added contains comments with instructions that explain how to modify the code to load your own text files instead of the Lorum ipsum file.
The next step will be to load an external JPEG file when the third tab is clicked and then modify the resulting ActionScript to control the placement of the JPEG on the Flash stage.