Getting values from the URL string in AS3 isn’t very complicated. First you need to set up your html to pass these into the SWF using a javascript function:
Place this inside your html.
Then if you are using the default HTML publishing you need to set up your SWF to take the variable. In this example I’m looking for a variable called ‘transition’
...
...
The important lines are:
‘FlashVars’, ‘transition=’+gup(“transition”),
and
param name=”FlashVars” value=”transition=”+gup(“transition”)
Here we are calling the javascript function to return the value that matches ‘transition’. Then this gets passed to the SWF.
Inside the flash this can be accessed with:
var sTrans:String = String(stage.loaderInfo.parameters.transition)
Then you can get variables from the URL string:
http://www.sitedaniel.com/index.html?transition=myvalue
You can add more values to this string by adding an ampersand (&) between value pairs
http://www.sitedaniel.com/index.html?transition=myvalue&colour=red
Helped me!
Thanks!
Thanks
I have been looking for something like this for a long time. Nice post and it worked the first time. Now all I have to do is create a link to point to my various movie file.
Do you have this code for CS5, I will be upgrading soon.
Thanks again