Select Page

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