
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
60
|
Chapter 2: Variables
Similarly, an HTML document’s <OBJECT> and <EMBED> tags can create variables in a
Flash movie, when the movie initially loads, via the
FlashVars parameter or a query
string. Variables passed to a Flash movie via
FlashVars or a query string must be
URL-encoded according to the rules described in the LoadVars class in the Language
Reference. The following code uses the
FlashVars parameter to create the variables
authorName and bookName with the values “Colin Moock” and “ASDG” on the main
timeline of a movie called main.swf:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"
WIDTH="550"
HEIGHT="400">
<PARAM NAME=movie VALUE="main.swf">
<PARAM NAME=FlashVars VALUE="authorName=Colin+Moock&bookName=ASDG">
<EMBED src="main.swf"
FlashVars="authorName=Colin+Moock&bookName=ASDG"
WIDTH="550"
HEIGHT="400"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
</OBJECT>
The FlashVars parameter requires Flash Player 6 or later and can pass a maximum of
63 KB of data to Flash. To pass data from HTML to earlier Flash Players, append the
parameters to the URL of the .swf filename, as shown in the following example. In
this case, the data transfer ...