Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Using FlashVars to pass variables to a SWF

Using FlashVars to pass variables to a SWF


The FlashVars property of Macromedia Flash Player provides an efficient method of importing variables into the top level of a movie when first instantiated. This feature requires Flash Player 6 (or later). For information on passing variables with earlier versions, refer to Additional Information below.


Placed within the Object (ActiveX) or Embed Tag (Netscape and Macintosh Internet Explorer), the property “FlashVars” can be used to import root level variables to the movie. All 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 ‘&’. Special and/or non-printable characters can be escaped with a ‘%’ followed by a 2 digit hexadecimal value. A single blank space can be represented using the ‘+’ sign.

All browsers will support string sizes of up to 64KB (65535 bytes) in length. FlashVars must be assigned in both the OBJECT and EMBED tags in order to work on all browsers.

Object Tag Example:


Embed Tag Example:

<EMBED src="display.swf" FlashVars="foo=Hello%20World¶graph=first+line%
0Dsecond+line" ... (other parameters)> </EMBED>

Encoding of this string is the same as the page containing it. Internet Explorer is responsible for providing UTF-16 compliant string on a Windows platform. Likewise, Netscape will provide a UTF-8 encoded string to the player.