I need some clarification on this subject as I just ran into an issue with loading swfs into a reused loader object.
So lets say I have 3 SWFs.
Main.swf
childA.swf
childB.swf
Main.swf has a loader object in it that gets reused (myloader.load("childA.swf")) and childA or childB swf will be loaded via user interaction.
Both child swfs have a com package with a class in that package called config.
The config files are different files for both classes just named the same.
both child swf also dispatch an event that the Main listens for
Now the problem I had was if childA was loaded first then after childB was loaded it would still show as childA. Basically, whichever one got loaded into that loader first would be the winner.
This drove me nuts as nothing I did would cause the swf to unload. Not until I found the following code.
var appDomain:ApplicationDomain = new ApplicationDomain();
var context:LoaderContext = new LoaderContext(false, appDomain);
_contentPanel.load(new URLRequest(str), context);
I stumbled over this code on a post somewhere talking about how to truly unload a swf. Apparently, This also applies to how to truly load a swf.
As you can see a new appDomain is created and assigned to the context when loaded.
This works like a dream I can now load and unload all day long.
My confusion is the event that the child dispatches still works, when I don't think the Main swf should pick it up due to it not being in the same appDomain.
I mean shouldn't the event be blocked?