Animation

  1. Home
  2. Computing & Technology
  3. Animation

Using Variables from an External Source with Flash's loadVariables()

By Adrien-Luc Sanders, About.com

1 of 9

Before you can load an external file from Flash, you'll need to create the file first. I prefer to use .txt (text) files for basics, and usually set up my variables in Notepad. For this example, I've created four variables and saved them in Notepad: typecolor, typetext, typestyle, and typesize, as we're going to use them to alter the text displayed by a Flash SWF. The format is pretty simple:
typecolor=990000
typetext=Now my text is loaded by variables.
typestyle=Times New Roman
typesize=30

The variable values are now defined much as we would in Flash, only without quotes around things like the font name. I also chose not to put the 0x in front of the hex value for the font color; that's just an old habit, as I like to keep it in plain HTML should I use the variable for certain other things, and use ActionScripting to append the 0x when I need it.

Explore Animation

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Animation

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Using Variables from an External Source with Flash's loadVariables()

©2009 About.com, a part of The New York Times Company.

All rights reserved.