setVar

Populates a variable in the Flash movie with the value specified.


Availability:

First available in version 3.0 build 2039.


Input Parameters:

variable - String - The full path of the variable that will be populated with the value specified.

value - String - The value with which to populate the Flash variable.


Output Parameters:

None.


Notes:

The path to the variable must originate in _level0 or _global. If you are specifying a variable on _global, you must specify "global" - _global without the inital underscore. Default path is _level0.


Examples:

Example 1:
A simple example of setting a Flash variable to a string value.

Flash.setVar({variable:"_level0.status",value:"Hello World"});

Example 2:
A simple example of setting a Flash variable to a number value - the value will be of type Number on the ActionScript side.

Flash.setVar({variable:"_level0.status",value:12});

Example 3:
An example of setting a Flash variable to be an object - the value will be of type Object on the ActionScript side.

Flash.setVar({variable:"_level0.status",value:{test:1234,color:"FFFFFF"}});

Example 4:
An example of setting a Flash variable to be an array - the value will be of type Array on the ActionScript side.

Flash.setVar({variable:"_level0.status",value:["SWF","Studio"]});