我正在使用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;
}
}
}