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
Developer
Posts: 136
Registered: ‎03-04-2009
My Device: Not Specified
Accepted Solution

Image loader anyone?

Hi All,

 

So sorry if there is already answer here but I could not find it. This used to work on the simulator but does not work on device:

 

    myLoader = new flash.display.Loader();

 

    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onPreviewCom);

 

    myLoader.load(new URLRequest("file:///accounts/1000/shared/camera/IMG_00000005.jpg"));

   // yes folks the jpg exists and the location is correct..

 

 

.....

 

     private function onPreviewCom():void{   

 

          /// Hmmmmm! code NEVER get here, never completes dowload (or upload, whatever)

 

         addChild(previewLoader.content);

     }

 

Any ideas???

 

Thanks! Udi

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Image loader anyone?

The URL might be different between the simulator and the device. Hard coding paths like this is dangerous. Use the File class to get the relative position of the file then use the url or native path method of the file class to the URLRequest object.
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Image loader anyone?

Also make sure to do <action>access_shared</action> to rrquest permission to read and write to the shared directory.
J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Highlighted
Developer
Posts: 136
Registered: ‎03-04-2009
My Device: Not Specified

Re: Image loader anyone?

Bingo! that was the issue! Thanks J