Starling和cameraroll上传类型强制

时间:2012-12-07 04:01:42

标签: actionscript-3 air starling-framework

我正在尝试在这里实施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。

1 个答案:

答案 0 :(得分:0)

您是否同时导入了Flash事件和starling事件?确保将starling事件传递给onMediaLoaded函数。 所以:

function onMediaLoaded(event:starling.events.Event){
   //do stuff
}

function onMediaLoaded(event:Event){
   //do stuff
}