I’ve had a couple special requests to explain flashvars and how to use it and show it in action.
The property “FlashVars” can be used to import root level variables to the flash movie or swf. The flashvars propery is used in codes for embedding flash in the html page. The string of variables passed in as flashvars, will be imported into the top level of the movie when it is first instantiated. Variables are created before the first frame of the SWF is played. The format of the string is a set of name=value combinations separated by ampersand (&) symbols.
- Include the flashvars property in your embed codes and voila! You have these variables to use in your swf.
- That’s the one step
HTML Embed Codes
[cc lang=”html” tab_size=”2″ lines=”40″]
Here’s some sample embed codes, including object and embed tags:
Actionscript using flashvars
[cc lang=”actionscript” tab_size=”2″ lines=”40″]
display(“var1 = “+ var1);
display(“var2 = “+ var2);
display(“var3 = “+ var3);
display(“var4 = “+ var4);
feedback.text += todisplay+”\n”;
Download the html files and the fla and swf in this flashvars.zip