9 Replies Latest reply on Aug 19, 2009 8:47 AM by Jens Wegar

    Sub-apps event passing in multi-versioned application - type coersion fails

    Jens Wegar Level 1

      I have the following structure on an application I'm working on:

       

      AirWrapper, basically just an AIR wrapper for the core. Includes AIR specific definitions of various classes needed by the core.

          |---- loads core.swf using SWFLoader, contains functionality for handling data saving/loading, subapp loading, etc.

                   |-----loads subapp.swf using SWFLoader, with loadForCompatibility = true;

       

      From subapp.swf I'm dispatching a ServiceReferenceEvent (custom event), which is supposed to be caught by the core.swf. If I set loadForCompatibility = false, then it works as it should. However if I set loadForCompatibility = true, then I get a

       

      TypeError: Error #1034: Type Coercion failed: cannot convert fi.activeark.platform.events::ServiceReferenceEvent@1e0afeb1 to fi.activeark.platform.events.ServiceReferenceEvent.

       

      Now if I've understood the documentations correctly, the reason this error pops up is because the subapp is loaded into a sibling application domain of the core.swf and is therefore using it's own definition of the ServiceReferenceEvent (even though both the core and the subapp in fact reference the same .as file). My research on the issues suggests that I should be able to fix this by boot strapping the ServiceReferenceEvent class into AirWrapper. This should make both the core and the subapp use the same definition.

       

      The problem is that this doesn't work. Does anyone have any thoughts on why? Alternatively I would be happy if someone would suggest an alternate method for communicating between a main and subapp swf with loadForCompatibility = true (preferrably one that would allow me to pass custom events)? I need the loadForCompatilbility = true because we're expecting subapps to be created with different versions of the Flex framework over the life cycle of the application.