今天把开发好的flex应用部署到flex开发的portal中出现了一个问题,数据加载的方式采用blazeds+spring,第一次加载数据没有问题,第二次加载就报强制类型转换的异常。如下:
TypeError: Error #1034: 强制转换类型失败:无法将 com.ultrapower.screen.model::KpiRegion@143c06a1 转换为 com.ultrapower.screen.model.KpiRegion。
at com.ultrapower.screen.component::SummaryKpi/createSummaryKpiPanel()[D:\development\Adobe\Flex Builder 3\workspace\screen\src\com\ultrapower\screen\component\SummaryKpi.as:44]
at com.ultrapower.screen.component::SummaryKpi()[D:\development\Adobe\Flex Builder 3\workspace\screen\src\com\ultrapower\screen\component\SummaryKpi.as:31]
at province/getProvinceKpiListHandler()[D:\development\Adobe\Flex Builder 3\workspace\screen\src\province.mxml:169]
at province/___province_Operation1_result()[D:\development\Adobe\Flex Builder 3\workspace\screen\src\province.mxml:288]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
google了一下,发现网上有人说是模块加载时,转型的问题,解决如下:
在应用中添加映射就可以了,
registerClassAlias("com.ultrapower.screen.model.KpiInfo",KpiInfo);
另外网上有一篇文章说了三解决方案:http://www.myflexhero.com/share/flex-hero-flex4/flex-hero-coding-techniques/308