tags:

views:

278

answers:

2

Hi, i hope anyone can give me an hint to my issue...

i have an Application with modules. Every Module lives for itself. There are no shared events or something between them. In my modules there is a datagrid and with a contextmenü, the details of selected data opens in a popupwindow. The modules are controlled by an loalEventMap and a presentationModel as usual. If i closed the popup immediantly and open it again, all works fine, but if i change some data in the popup, close it unload my module and loade the module again, open the popup again, mate throw the following error:

  • ERROR: Unable to set property model on CDBInputMask because is not type CDBPresentationModel. Provided value was of type CDBPresentationModel
  • TARGET: CDBInputMask
  • TARGET KEY: model
  • TAG: PropertyInjector
  • FILE: CDBLocalEventMap
  • STACK TRACE: TypeError: Error #1034: Type Coercion failed: cannot convert com.mycomp.myMod.ui.presenters::CDBPresentationModel@5d13cf1 to com.mycomp.myMod.ui.presenters.CDBPresentationModel. at com.asfusion.mate.core::Binder/bind()[/Users/Nahuel 1/Documents/Flex Builder 3/Mate_trunk/src/com/asfusion/mate/core/Binder.as:90] at com.asfusion.mate.actions::PropertyInjector/run()[/Users/Nahuel 1/Documents/Flex Builder 3/Mate_trunk/src/com/asfusion/mate/actions/PropertyInjector.as:205]

my implementaion are: open Popup:

    inputMask = new CDBInputMask();
    PopUpManager.addPopUp(inputMask,this,true);

close Popup:

 PopUpManager.removePopUp(inputMask);

inputMask = null; Injector:

 <Injectors target="{CDBInputMask}" debug="true" dispatcherType="global" >

In the mate-Forum i've found a thread with a similiar problem. But not exact. Here the moderator meent, it looks like to try to instanceiate a class twice in a module. In my case, the popupmanager is a singleton class. so it looks loke the same problem. first all works fine, but second it crash, cause the class is already injected.

I try to figure out with debugger and traces how to cleat the popup or how to clear the module. But i'd found a solution. Now i depend on you. Can you please help me? If you need any further code, i'll post it.

Thanks in advanced Frank

A: 

Sounds like ApplicationDomain issues.

What is likely happening is that the class definitions are being loaded multiple times on different security domains. This will cause the casting issues despite the objects looking like they are of the same class. As far as the Flash runtime is concerned they are not the same type unless they are on the same security domain.

To resolve this give the loader a context with your main application's security domain used (assuming you are using the Loader class to load your modules):

var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
loader.loader(request, context);
Rhysyngsun
A: 

Pow, thats it! Thank you verry much. You've saving my ass.

Best Regards Frank

Frank