Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
davidsmith1307
Posts: 2
Registered: ‎06-27-2011
My Device: Curve 8900
My Carrier: O2

IOError with CameraUI and MediaPromise

I am trying to capture still images using CameraUI but I always get the following exception:

 

Error #2044: Unhandled IOErrorEvent:. text=Error #3003: File or directory does not exist.

 

The pertinent code is:

..

cameraUI.addEventListener( MediaEvent.COMPLETE, imageCaptured );

..

private function imageCaptured( event:MediaEvent ):void
        {
            trace( "Media captured..." );
            var cameraUI:CameraUI = event.target as CameraUI;
            cameraUI.removeEventListener(MediaEvent.COMPLETE, imageCaptured);
            cameraUI.removeEventListener(Event.CANCEL, captureCanceled);
            cameraUI.removeEventListener(ErrorEvent.ERROR, cameraError);
           
            var imagePromise:MediaPromise = event.data;
           
            if( imagePromise.isAsync )
            {
                trace( "Asynchronous media promise." );
                imageLoader = new Loader();
                imageLoader.contentLoaderInfo.addEventListener( Event.COMPLETE, asyncImageLoaded );
                imageLoader.addEventListener(IOErrorEvent.IO_ERROR, cameraError );
                imageLoader.addEventListener(Event.INIT, initHandler);
                imageLoader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                imageLoader.addEventListener(Event.OPEN, openHandler);
               
                var context:LoaderContext = new LoaderContext(false);
                trace( "Loading media promise." );
                imageLoader.loadFilePromise( imagePromise, context );
                trace( "Loaded media promise." );
            }
            else
            {
                imageLoader = new Loader();
                trace( "Synchronous media promise." );
                imageLoader.loadFilePromise( imagePromise );
                showMedia( imageLoader );
            }
        }

 

The last trace message is "Loaded media promise".

 

The image is captured correctly, in that it can be seen in the Picture application.

 

Any pointers would be welcomed.

 

Thanks

Please use plain text.
New Developer
vinoth_fi
Posts: 22
Registered: ‎05-04-2010
My Device: Blackberry Torch and Playbook
My Carrier: Wireless Technology

Re: IOError with CameraUI and MediaPromise

Hi david,

         Have you given permission "access_shared" in your blackberry-tablet.xml?

        "<action>access_shared</action>".

 

please check the other post for the solution of your problem before creating a new thread.

Please use plain text.
New Contributor
davidsmith1307
Posts: 2
Registered: ‎06-27-2011
My Device: Curve 8900
My Carrier: O2

Re: IOError with CameraUI and MediaPromise

Your response was the clue! I had added this line to the file but had not noticed that the file appears to be regenerated automatically.

 

I found the checkbox in the Export -> Release Build dialog, set it there and then it worked a treat.

 

Thanks for the reply.

Please use plain text.