Flashvars

// variable is passed into the swf via Javascript (most likely swfObject)
// myswf.swf?myFlashVar="a new value"

var myFlashVar:String = "Some Default Value";
if (root.loaderInfo.parameters.myFlashVar){
   myFlashVar = root.loaderInfo.parameters.myFlashVar;
}

Getting at flashvars in AS3 requires a bit more typing than it did in AS2. Above is a technique I find myself using from time to time. Usually for paths to xml or dynamic callouts (large buttons with text, an image and a link that change frequently).

Leave a Reply

Your email address will not be published. Required fields are marked *