Friday, May 21, 2010

Passing Simple QueryString Data from SWF to SWF using SWFLoader

Lot of posts out there with people trying to get around this one. It's a pain; under certain (most) conditions, if you try to simply load a swf into a swfLoader, and pass parameters by appending the path to the swf, when you test the parameters in the loaded swf, you get nada.

Ugh.

Easy workaround; use this in the LOADED swf (so in the code of the swf you loaded):

Application.application.loaderInfo.loaderURL

That reveals the entire path the loader of that swf used. After that, parse out your values and off you go. Not as nice as if they appeared as neatly packaged object properties, but it works, and parsing a querystring is 101 stuff anyway.

Easy one, but effective.

As always, thanks for visiting.