Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Coercion Failed Errors Passing Third Party Data Types Swf to Swf

New Here ,
Oct 01, 2014 Oct 01, 2014

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?

TOPICS
ActionScript
395
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 01, 2014 Oct 01, 2014

anyone?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 09, 2014 Oct 09, 2014
LATEST

Usually this means that you don't have the Class referenced in the top level Application domain, so the first child domain to load gets the "real" definition, and the other one gets all the numbers appended at the end (and they are not the same).

If it truly is a third-party Type, you're kind of stuck with making sure you have a variable defined of that type at the top level. If you have more control than that, then you should look at defining an Interface that the type will then implement and only refer to it by Interface. This avoids having to have a baked-in implementation compiled into swfs that don't need to know that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines