Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Flash Tutorials Load Parameters From a Text File to Flash Animation Using loadVariables() function
Your Ad Here

Load Parameters From a Text File to Flash Animation Using loadVariables() function


This tutorial was written for the Flash Designer software, which allows you to create flash animations in a much easier way than by using Macromedia Flash. You may get Flash Designer here.

Text file must be in the format:

param1=value1&param2=value2

t1012.txt

Load text file by using:

loadVariables("t1012.txt");

Usually in Frame's ActionScript.

Create 2 edit fields for param1 and param2. Name fields Edit1 and Edit2. Create "Set Variables" button. Use the following ActionScript code for button's OnUp (or OnClick) event:

Edit1 = param1;
Edit2 = param2;

To complete the tutorial:

1. Create a folder and download t1012.txt file to the folder.

2. Launch Flash Designer. Choose "Frame" > "Frame Size" to set movie size (300 x 200).

3. Choose "Frame" > "ActionScript" and use the following code:

loadVariables("t1012.txt");

4. Choose "Edit Field" tool and draw 2 edit fields.

5. Choose "Select" tool. Double click each edit field and change "Variable name" to "Edit1" and "Edit2".

6. Choose "Button" tool and draw a button below edit fields.

7. Choose "Select" tool. Double click the button to edit OnUp event. Select "actionscript" and enter the code. Click OK.

8. Change frame duration to "stop" .

9. Choose "File" > "Export SWF file" and export the file to the same folder with txt file.

10. Choose "File" > "Export HTML Page", a page with Flash animation should pop up in a new browser window.

11. The script will not work in preview mode unless you put txt file in the temp folder.



Author's URL: Selteco.com
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Internet & computing Flash is a vector-based moving graphics format created by Macromedia for the publication of animations on the World Wide Web. More Flash & Swish: Most Popular Materials | Fresh Materials | More Flash Tutorials at FlashPerfection.com

Add comments to "Load Parameters From a Text File to Flash Animation Using loadVariables() function"

Only registered users can write comment

No comments yet...