0

I am trying to implement the cameraUI here
Upload Library or captured images on iOS with Flex Mobile 4.6

in my starling project to allow a user to select an image and upload to a server but I am getting an error:

Error #1034: Type coercion failed: cannot convert starling.events::Event@752c0d1 to flash.events.Event

Looks like is the culprit:

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();
        }
    }

I am using Starling to utilise Feathers UI.

Community
  • 1
  • 1
puks1978
  • 3,667
  • 11
  • 44
  • 103

1 Answers1

0

Do you have both flash events and starling events imported? Make sure you pass the starling event to the onMediaLoaded function. So:

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

not:

function onMediaLoaded(event:Event){
   //do stuff
}
slynagh
  • 601
  • 4
  • 16