Load Variables Into Flash via Text File

Load Variables Into Flash via Text File
Difficulty: Easy
Description: loadvariables-in-flash
Author: M@ster; Date Added: 2008-10-12; Views: 29468
Loadvariables is an easy way to get variables from your site into your flash program. In this tutorial I will show you how you can create a text file and then load the variables so they can be displayed into a flash program.

First open your flash program. Preferably Adobe Flash CS3 Professional. Then create a "Flash File (ActionScript 2.0)". Click on the text button and make a Dynamic Text about 400px in width and 100px in height (can be whatever width and height but for this example its preferred).

Please change the properties of the text box you just made to this below:

No click off so that none of the objects or text areas are selected in your preview area. And then go to Window -> Actions or press F9 and then add this code to it:


Ok, now that we have all the flash setup we want to save your flash program in any folder (Make sure to remember where you saved it). Now open up Notepad or any other text editor.

Copy and Paste this code into your text editor (notepad).

text=Hello World

Now save the file in the same folder you saved your flash program and save this as "data.txt" (Without the quotes)

In the future if you plan on adding more than one variable you have to put an "&" at the end of ever variable so it would look like this: text=Hello&text2= World

Now if you did all these step and an when you go to Control -> Test Movie it should display "Hello World" on your flash program.