0

I am making a game where each screen is loaded in as a separate swf. I am loading the swf using Greensock's LoaderMax, but I don't think that is what is causing the issue. After I load in the swf I can set properties of the child swf like String and MovieClip. However, I have a third party library in the library path, the same exact swc for both projects. However, when I try to pass non-system variables it gives an error basically saying "Coercion failed: cannot convert ThisType to ThisType". If they are the same data type, why is the compiler trying to coerce them? I must be missing something here...

The Error:

TypeError: Error #1034: Type Coercion failed: cannot convert package::ThisType@7ffecfe4ba1 to package.ThisType.

at mJackStateMachine/onAskForClient()

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

Here is the (simplified) complete handler. It breaks when I try to pass the var a_thisTypeVar of type ThisType between swfs:

function CompleteHandler(e:LoaderEvent) {

childSwf = LoaderMax.getContent("LoginStateSwf").rawContent;

stage.addChild(childSwf);

childSwf.start(_thisTypeVar)

}

Please help! How to I pass vars from third party libraries between swfs. I should be able to do this, right?

Mc' Flips
  • 1,023
  • 2
  • 9
  • 9
  • I think what may be happening is that the loaded (secondary) SWF does not know what the ThisType object type is. Meaning you have a type that is known to the main SWF but the loaded (secondary) SWF does not know the type. What does ThisType extend? It would be helpful to see what _thisTypeVar is set to, and generally what ThisType is. – C. Parcell Oct 01 '14 at 17:18
  • ThisType is playerio.Client, both swf's import this class and have the same playerio.swc in the build path – Mc' Flips Oct 01 '14 at 20:18
  • How are you building the SWFs? If playerio.swc is being included in both SWFs, you'll have two competing definitions of ThisType. Including the SWC as a runtime shared library in the child SWF might resolve the issue. – Brian Oct 02 '14 at 16:22
  • Hi Brian. I am comililng the swf's from flash professional, but all code is being written in flash builder. RSL is not an option for me as I'm using flash player, not flex. – Mc' Flips Oct 02 '14 at 17:33
  • You are including swc with the same classes two times. That seems to be the issue. You may need to plan out the flow so that the swc are not called 2 or more times. – Vishwas Oct 02 '14 at 20:56
  • @VishwasG how do you do that? Can you give an example in an answer? – Mc' Flips Oct 03 '14 at 21:48
  • I would need to look into the structure. Can you please send me the minimal version of the project ? ( Removing all the unnecessary code ) – Vishwas Oct 05 '14 at 06:10

1 Answers1

0

Try this one:

LoaderMax.defaultContext = new LoaderContext(true, new ApplicationDomain(ApplicationDomain.currentDomain), SecurityDomain.currentDomain);