Loaded SWF Keeps Reloading in Flash

Posted by Tres Fri, 06 Mar 2009 04:02:00 GMT

So I’ve been working on a loaded SWF – pretty easy stuff with Actionscript 3 – just use Loader() and go, right?

Well, I found out the hard way that the namespace of the Document Class for a loaded SWF is not so separate as you’d like to think. So if you happen to use the same name for your Document Class in both the loader and the loaded SWF, you can count on the loader’s Document Class being run over again once the loaded SWF has completed loading.

So if you’re like me & you’re coming from Java or another C based language that uses Main as the run loop, you can count on some funky behavior; the problem is that Flash is calling Main() when the loaded SWF is downloaded and is hitting Main() in the loader.

It’s always the little things, right?

Posted in  | Tags ,