1. Home
  2. Computing & Technology
  3. Animation

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

By , About.com Guide

8 of 9

With the variables loaded, now comes the easy part: using text properties and TextFormat to assign them to the various attributes of my text box.
onClipEvent(enterFrame){
loadVariables("variables.txt", this);
_root.textbox.text=typetext;
textvariables = new TextFormat();
textvariables.multiline = true;
textvariables.wordWrap = true;
textvariables.border = false;
textvariables.color = "0x"+typecolor;
textvariables.font = typestyle;
textvariables.size = typesize;
_root.textbox.setTextFormat(textvariables);
}
You don't need to use paths for the variables because they're loaded right into the clip and are all considered "local". Just fill the variable names in where you would normally type absolute values for things like instancename.text, TextFormatname.color, etc.
Explore Animation
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  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.