Skip to content


Get a Query String From a SWF File

If you want to get a query string off a SWF file name there is a short line of code that does it. This is one of those things that I just can’t figure out logically; I just have to memorize how to do it. I’ve done this once or twice before in AS2 and it was a little bit easier then. This points to the LoaderInfo of the main SWF file. Then you get the parameters property from there. The FlashVars parameter in the SWF’s HTML page does the same thing as adding a query string to the file name.

var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

For the SWF file name “player.swf?src=video.flv” the code to get the src value would be the following.

var src:String = paramObj["src"]; //would get "video.flv"
var srcAlso:String = paramObj.src; //same using property instead

Posted in ActionScript 3.0, Work. Tagged with , , , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(never shared)

or, reply to this post via trackback.