I have an object being passed between flash and flex using the a custom event. I am importing a library in flex containing a copy of the object's class. The classes are identical, but when I attempt to access the object in flex I get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert com.cackleberries.data.api::ApiObject$ to com.cackleberries.data.api.ApiObject.
Any ideas?
This function is passed into flash as a callback from AIR / flex
public function airEventHandler(type:String, data:Object):void
{
switch(type)
{
case "air_api_call":
if(data)
{
if(data.hasOwnProperty("apiObject"))
{
trace("got air api call event in application");
serverApi.makeApiCall(ApiObject(data.apiObject));
}
}
break;
}
}
I am getting the error when I pass the ApiObject
to serverApi.makeApiCall
. That function takes an ApiObject
as its parameter. Initially, the data object is created with with the apiObject
key with a ApiObject
as the value (done in flash).