BlazeDS / PureMVC e condivise Vos
-
30-09-2019 - |
Domanda
Sto costruendo applicazione modulare con 2 moduli che condividono vo comune: ShopRegionVO Questo vo è anche un'entità BlazeDS e viene associato ad un oggetto Java remoto. Quando i carichi shell primo modulo tutto è ok. Il secondo modulo è un elenco di ShopRegionVOs e variazione della voce viene gestita con il seguente codice:
sendNotification(CoverageConstants.SET_SELECTED_REGION_COMMAND, ShopRegionVO(List(e.target).selectedItem));
L'eccezione viene generata proprio qui:
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
Lo ShopRegionVO è in libreria Flex separato che è condiviso tra i moduli:
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;
}
}
}
Soluzione
Ecco una soluzione:
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow