Flash Script – Load a Text File Into Flash

Tweet


type = 'application/x-shockwave-flash'
data = 'http://sitepointstatic.com/flash/loadtext.swf'
width = '400'
height = '400'
bgcolor = 'black'
>

Download the sample files here.

1. Create two textfields. Name the first "text1", and second "text2".

2. Open notepad or any other text editing software, and enter the text below:

text1=This is text1 

And:

text2=This is text2 

3. Go to Flash, and in the current layer frame insert the action:

loadVariablesNum ("text.txt", 0); 

4. That’s it! Press ctrl+enter to test the movie.

Free JavaScript: Novice to Ninja Sample

Get a free 32-page chapter of JavaScript: Novice to Ninja and receive updates on exclusive offers from SitePoint.

No Reader comments