Flashvars are variables which can be passed from a web page to a Flash (SWF) file. This means that you can define any variables you like in the HTML of a page and these variables can be used by the Flash file.
There are many reasons for doing this. For example, you can reuse the same Flash file on different pages, but alter certain aspects using variables. Here at MediaCollege.com we use the same Flash video player on multiple pages and use flashvars to define which video clip is played on each page.
Flashvars are included in the object and embed code, as per the example below. In this example, the following variables are defined and available to Flash:
myvar1 = value1
myvar2 = value2
Each variable name/value pair is separated by an ampersand (&) sign.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="200" height="200">
<param name="movie" value="myflashfile.swf">
<param name="FlashVars" value="myvar1=value1&myvar2=value2">
<embed src="myflashfile.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="200" flashvars="myvar1=value1&myvar2=value2"> </embed>
- Spaces in variable values can be represented with the "+" sign, e.g. myvar3 = value+3
- Flashvars are supported by Flash Player 6 and later.