Jump to content
Search Community

SWFLoader getClass can't return null anymore

gigbig test
Moderator Tag

Recommended Posts

Hi,

I am having a really weird problem: my game compiles as always (I didn't change it for months), but today Flash Player (an old version, I didn't updated it) all of a sudden started giving me an error when compiling the recompiled SWF: the error is in the SWFLoader getClass function, it doesn't find a movieclip in the library, but it doesn't simply returns null as always did, it now causes an error that blocks the execution of the debugger!

Didn't getClass simply return null if the requested resource was not found?!

Link to comment
Share on other sites

Sorry to hear about the problem. Yes, getClass() returns null if nothing is found

 

public function getClass(className:String):Class {
if (_content == null || _scriptAccessDenied) {
return null;
}
if (_content.loaderInfo.applicationDomain.hasDefinition(className)) {
return _content.loaderInfo.applicationDomain.getDefinition(className);
} else if (_queue != null) {
var result:Object;
var loaders:Array = _queue.getChildren(true, true);
var i:int = loaders.length;
while (--i > -1) {
if (loaders[i] is SWFLoader) {
result = (loaders[i] as SWFLoader).getClass(className); 
if (result != null) {
return result as Class;
}
}
}
}
return null;
}

We haven't touched the SWFLoader code in about 2 years, so nothing has changed on this end.

 

As you can see we are just tapping into native AS3 methods like

loaderInfo.applicationDomain.hasDefinition(className)

loaderInfo.applicationDomain.getDefinition(className)

 

My advice would be to add a bunch of trace() messages into each condition above to see where its failing and also to create a very simple example without SWFLoader that attempts to load a swf and run the same native methods. 

 

If you can prove the native methods are failing it might help Adobe resolve this. My guess is that they changed something in the debugger that needs looking into.

 

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...