1
votes

I have main application that loads external swf's through the Loader Component. But some swf's that are working well on their own don't load into the main app. When I tried to load one of that swf's from fla of main app it gave error that it's looking for some classes. By the name of this classes it looks like it were parts of loaded swf but as swf that is already compiled and working well why is it looking for this class when it's trying to be loaded by the main app?

I didn't find anything that would refer to this kind of issue. Any help will be highly appreciated.

2
Gonna have to post some code and related errors to get anywhere on this.Bosworth99

2 Answers

1
votes

It seems like you got an application domain collision. This can happen if you got conflicting class names in each SWF (e.g swf1 has a class named Main, swf2 has a class named Main as well).

To fix that, load the SWFs into a new application domain:

loader.load(new URLRequest("g.swf"), new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain)));

If it's not that, you most likely have some code on the first frame of the movie that executes on initialisation of the SWF (See if you get Event.INIT before you get Event.COMPLETE).

This can be easily fixed by removing the code from the frame.

0
votes

Just for checking I made fla file that contained only Loader component and code of loading:

var loader:Loader = new Loader();
addChild(loader);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingFunc);
loader.load(new URLRequest("g.swf"));

function loadingFunc(event:Event):void{
    var li:LoaderInfo = event.target as LoaderInfo;
    var mc:MovieClip = MovieClip(li.content)
}

This code is from the testing file. But even this way it still looking for some class that seems to be one of external loaded swf. The error is such:

TypeError: Error #1009: Cannot access a property or method of a null object reference. at src::Dedo() at src::Main()

I have no such classes in my main app. So it could be only classes from external swf.