Jump to content
Search Community

SWFLoader CustomClasses and Document Class

rkrasky test
Moderator Tag

Recommended Posts

Hi!

 

First, thanks a lot for the great work of LoaderMax and Tween classes.

I got a serious problem, tried everything to solve but I got no solution:

 

Movie A load Movie B

Movie A is a Sprite extended with class named CustomClassName

Movie B is extended with a document class named CustomDocumentClass

 

If I trace mySwfLoader.rawContent I get [object CustomDocumentClass] -> correct

If I trace mySwfLoader.rawContent as CustomDocumentClass I get null -> wtf?

 

I can add the loaded swf to stage with addChild(mySwfLoader.rawContent), but then if

I try to access the parent CustomClass:

 

If I trace parent I get [object CustomClassName] -> correct

If I trace parent as CustomClassName I get this error message:

TypeError: Error #1034: Type Coercion failed: cannot convert CustomClassName@2ab4ff89 to CustomClassName

 

Please help...

Link to comment
Share on other sites

I am sorry I can't be of more assistance but have you tried using this debugger to help?

 

http://demonsterdebugger.com/

 

It can generate the client class files you need, just drop them somewhere your compiler can find it. It can give you detailed drilldowns into your app with class names, etc. so you can do things like so:

 

import nl.demonsters.debugger.MonsterDebugger;
MonsterDebugger.trace(this, mySwfLoader.rawContent);

 

Some other possible tips are here:

http://stackoverflow.com/questions/1797602/how-to-access-parent-movieclips-variable-from-loaded-swf

http://board.flashkit.com/board/showthread.php?t=771835

 

I'm sure better answers will surface soon!

Link to comment
Share on other sites

First of all, the "solution" mentioned on that blog is kinda dangerous - everything I've read indicates that the technique employed there poses significant security issues. I wouldn't recommend it. You really shouldn't need it anyway. What confuses me is that you said all your stuff resides in the same directory and there's no crossdomain stuff loading - really? I've attached an example set of FLAs/swfs that demonstrates the fact that it works fine in LoaderMax. I think I did exactly what you said you were trying to do, and it casts things just fine.

 

Another odd thing is that at the bottom of that "solution" blog post, someone else chimes in saying that they fixed it by just adding the SecurityDomain.currentDomain in the LoaderContext which is EXACTLY what LoaderMax does automatically for you, so I'm double-baffled as to why you're saying it doesn't work. Can you please post a sample set of FLAs that demonstrates the problem?

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...