BlazeDS / PureMVC和共享vos

时间:2010-04-21 08:13:47

标签: flex actionscript-3 module blazeds puremvc

我正在使用2个模块构建模块化应用程序,这些模块共享常见的vo:ShopRegionVO 这个vo也是一个BlazeDS实体,并映射到一个远程java对象。当shell加载第一个模块时,一切正常。第二个模块是ShopRegionVO列表,项目更改使用以下代码处理:

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

此处抛出异常:

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    

ShopRegionVO位于单独的Flex库中,该库在模块之间共享:

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;
        }
    }
}

1 个答案:

答案 0 :(得分:0)

这是一个解决方案:

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