I have Main.fla and SkinA.fla. Both have MovieClip library item: MC_BrandLogo.
I'm loading the SkinA.swf into Main.swf in the current application domain trying to replace the class inside Main.swf. If there is no library item in the Main.fla, I can instantiate MC_BrandLogo with the correct graphic. If the MC_BrandLogo already exist in the Main.fla then that graphic is used even though I loaded new one in the current application domain.
Is there a way to replace existing linked movie clips with loaded dynamically?
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSkinLoaded);
var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
loader.load(new URLRequest("SkinA.swf"));
function onSkinLoaded(e:Event):void {
trace("loaded Skin");
addChild(new MC_BrandLogo());
}
EDITED: There is no way to override the images I was trying to override, because this is how application domains work. If the definitions exist in the parent application domain, they are used.
1) ApplicationDomain don't have "getDefinitionByName" but "getDefinition"
2) using _skinAppDomain.getDefinition returns null for MC_BrandLogo and I'm sure it's linked in the SkinA.swf. Adding the whole loader shows the logo correctly
3)loader.content.loaderInfo.applicationDomain.getDefinition(brandLogoSymbolName) as Class; is getting the non-null definition but it's the Main's logo placeholder. – plam4u Feb 05 '12 at 11:59