In this tutorial I will explain how to pass variables to flash and what
dynamic things you could do with passing variables. Now you all have probably
seen a link that ends in index.php or index.swf. Now, sometimes
when you add a question mark ( ? ) mark to the end of index.php, it enables you
to do some cool things.
This link (it's not real) index.php?atkirupa=true will probably
display the same page but the page could look different if what follows the
question is referred in the web page as a variable. Flash can take the variable
and modify characteristics within the movie that the variable may refer to!
Here's how:
- First make a 440 x 300 (width and height) flash movie then add
this Action Script to your flash movie on the very first frame:
if (movie==1 or movie=="") {
trace("default");
}
if (movie==2) {
getURL("http://www.yahoo.com");
}
- Save and publish your work as pv.swf
- Preview the animation and, in your address bar, you'll see pv.swf
displayed. After pv.swf in your address bar, add the following argument:
?movie=2. Your address bar will look like:
pv.swf?movie=2
- If everything worked as planned, you'll probably be taken to the
Yahoo! home page.
Manually changing the value is cumbersome, and you did that because you are
testing it. When embedding the movie in your animation, you can simply call the
movie's name in the HTML as pv.swf?movie=2 or
set a Param tag that looks like this:
<Param name="FlashVars" Value="movie=2">!
Regards,
Brandon