我正在尝试在这里实施cameraUI Upload Library or captured images on iOS with Flex Mobile 4.6
在我的starling项目中允许用户选择图像并上传到服务器但是我收到错误:
Error #1034: Type coercion failed: cannot convert starling.events::Event@752c0d1 to flash.events.Event
看起来是罪魁祸首:
private function imageSelected( event:MediaEvent ):void
{
trace( "Media selected..." );
var imagePromise:MediaPromise = event.data;
dataSource = imagePromise.open();
if( imagePromise.isAsync )
{
trace("Asynchronous media promise.");
var eventSource:IEventDispatcher = dataSource as IEventDispatcher;
eventSource.addEventListener(starling.events.Event.COMPLETE, onMediaLoaded);
} else {
trace( "Synchronous media promise." );
readMediaData();
}
}
我正在使用Starling来使用Feathers UI。
答案 0 :(得分:0)
您是否同时导入了Flash事件和starling事件?确保将starling事件传递给onMediaLoaded函数。 所以:
function onMediaLoaded(event:starling.events.Event){
//do stuff
}
不
function onMediaLoaded(event:Event){
//do stuff
}