Adobe Flash Actionscript Flex Examples

FlashVars Basic Hello World Example

JavaScript and the latest version of the Adobe Flash Player are required. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

For the latest HTML you need to place the variables in twice. Once for the AC_FL_RunContent Javascript function and once for the OBJECT tag. The variables are message1 and name. Here is a snippet of the tags for Actionscript 3.

AC_FL_RunContent Javascript function:
'movie', 'FlashVarsEx01',
'FlashVars', 'message1=Hello World&name=Alonzo (Lon) Hosford',
'salign', ''

Object tag:
<param name="flashvars" value="message1=Hello World&name=Alonzo (Lon) Hosford" />

Here is a snippet of the tags for Flash 8 Actionscript 2 days. This is a basic example of sending variables to a Flash movie from the OBJECT PARAM tag and the EMBED tag The variables are message1 and name.

<param name="FlashVars" value="message1=Hello World&name=Lon Hosford" />
<embed flashvars = "message1=Hello World&name=Lon Hosford" src="FlashVarsEx01.swf"

These variables are then available on the _root (scene 1) timeline as Flash variables to use as needed.

The example shows the variables in a TextField and if you use Control Test Movie in the Flash IDE they are also displayed. This all happened when you loaded this page.

Take care not to select HTML checkbox in publish settings to create FlashVarsEx01.html as the download HTML file was changed manually to include the FlashVars part of the OBJECT and EMBED tag for Flash 8 and CS4 and the AC_FL_RunContent Javascript function for CS4.

Downloads:
All source files for Flash CS4 Actionscript 3: Download
All source files for Flash 8 Actionscript 2: Download
All source files for Flash MX 2004 Actionscript 2: Download
Search For More Flash Flex Actionscript Examples