Load An External Text File Into Flash - 2

Load An External Text File Into Flash - 2
Step 6. The other webpages. Except for the Portfolio webpage, we will repeat the steps above for all of the other webpages. Remember to begin by clicking on the Keyframe that corresponds to each webpage and you will need to make just a few changes each time. When you have completed each webpage, save the changes your made.

We set the Instance Name in the Property Inspector to Contact_Text. This is how Flash identifies the text block for the Contact Us webpage. For the other webpages set the Instance Name to the following.

Artist_Text
Products_Text
Weblog_Text

The third line of code in the ActionScript tells Flash which text file to import. Of course, these files should be in the same folder as your Flash SWF website file. For the Contact Us page, we named the external text file ContactUs.txt. (Ext_text.load("ContactUs.txt");) In the ActionScript code for the other webpages, replace that line of code with the following.

For the Artist webpage use this code--
Ext_text.load("Artist.txt");

For the Products webpage use this code--
Ext_text.load("Products.txt");

For the Weblog webpage use this code--
Ext_text.load("Weblog.txt");

The fifth line of code tells Flash to treat the text in the dynamic text block as HTML (Contact_Text.htmlText) and also assigns the imported text to a variable (ContactUs). For the other webpages, make these changes.

Artist_Text.htmlText = this.Artist;
Products_Text.htmlText = this.Products;
Weblog_Text.htmlText = this.Weblog;

Step 7. The external text files. The name of the text files you will import into your Flash movie should match the names used in the ActionScript.

Name each of the external files as follows.
ContactUs.txt
Artist.txt
Products.txt
Weblog.txt

The first thing in each imported file should be the name of the variable used in the ActionScript code. For the Contact Us page, we named the variable ContactUs. You will follow the variable name with an equal sign and then the text you wish to display on the webpage. So inside the ContactUs.txt file should look like this.

ContactUs=This will be the text that will show on the webpage.

For the other webpages you would change ContactUs to the following.

Artist=This will be the text that will show on the webpage.
Products=This will be the text that will show on the webpage.
Weblog=This will be the text that will show on the webpage.

The text that follows the equal sign can be plain text or HTML. However, Flash cannot recognize all of the HTML tags. Here is the short list of tags that you can use in your external files. You must remember to use quotation marks around the attribute values. (color="#000000")

<a href="https://……"> </a>
<a href="mailto:……"> </a>
<img src="name_of_image.jpg"> Must be jpg format.
<b> </b>
<br>
<font> </font> (including the face, color and size attributes)
<i> </i>
<li> </li>
<p> </p>
<span> </span>
<u> </u>

Note: The anchor <a> tag is treated differently in Flash. Although the link will work as usual, it will not be underlined as it is in the web browser. In order to underline the link, you will need to use the <u> </u> tags.

<a href="..."><u>Click here</u></a>

Step 8. Compress the external file. The last step in creating the external text file will be to use an HTML source compressor program to compress the file.

Step 9. Test the webpages. Click on Frame 1 on the Timeline Header to set the Playhead back to the beginning. Now click the Ctrl and Enter keys on your computer keyboard to open a preview of your website for testing. Click on each button in the menu and verify that the correct contents is displayed.

Step 10. Save Your Flash Movie. You can now save the new additions to your movie. Click File> Save.

Macromedia Flash MX 2004 Workspace

Copyright 2018 Adobe Systems Incorporated. All rights reserved. Adobe product screen shot(s) reprinted with permission from Adobe Systems Incorporated. Adobe, Photoshop, Photoshop Album, Photoshop Elements, Illustrator, InDesign, GoLive, Acrobat, Cue, Premiere Pro, Premiere Elements, Bridge, After Effects, InCopy, Dreamweaver, Flash, ActionScript, Fireworks, Contribute, Captivate, Flash Catalyst and Flash Paper is/are either [a] registered trademark[s] or a trademark[s] of Adobe Systems Incorporated in the United States and/or other countries.

Back





RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map








Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.