views:

139

answers:

1

Hello, SO

I'm building modular application with 2 modules which share common vo: ShopRegionVO This vo is also a BlazeDS entity and is mapped to a remote java object. When shell loads first module everything is ok. The second module is a list of ShopRegionVOs and item change is handled with the following code:

sendNotification(CoverageConstants.SET_SELECTED_REGION_COMMAND, ShopRegionVO(List(e.target).selectedItem));

The exception is thrown right here:

Main Thread (Suspended: Error #1034: Type Coercion failed: cannot convert model.vo::ShopRegionVO@14961809 to model.vo.ShopRegionVO.)    
    view.list::RegionListMediator/onChange  
    flash.events::EventDispatcher/dispatchEventFunction [no source] 
    flash.events::EventDispatcher/dispatchEvent [no source] 
    mx.core::UIComponent/dispatchEvent  
    mx.controls.listClasses::ListBase/mouseUpHandler    
    mx.controls::List/mouseUpHandler    

The ShopRegionVO is in separate Flex library which is shared between modules:

package model.vo
{
    [Bindable]
    [RemoteClass(alias="com.abc.RegionVO")]
    public class ShopRegionVO
    {
        public var name : String;
        public var id : int;

        public function ShopRegionVO(_id:int=0, _name : String=null) 
        {
            super();

            // init properties
            name = _name;
            id = _id;
        }
    }
}
A: 

Here is a solution:

http://www.object-factory.org/?p=38

mico