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
BlackBerry Development Advisor
jdolce
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: Loading local images using browseForOpenMultiple

It all depends on how you are loading the images.

If you are using the Loader class you need to use the url property.

If you are using the FileStream class then you need to use the File object.
Trusted Contributor
Sangram
Posts: 101
Registered: ‎03-04-2011
My Device: BB10-Dev Alpha

Re: Loading local images using browseForOpenMultiple

Please note that using nativePath also loaded the images in desktop air version, it only had problems on playbook. I don't understand what do you mean by using File object and accessing the user selected images with nativePath.

 

But using .url property, I was able to load the images on playbook.

BlackBerry Development Advisor
jdolce
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: Loading local images using browseForOpenMultiple

Can you post the code that was working on the desktop and not on the PlayBook. Would like to see if there is a bug somewhere.

 

 

There are 2 ways to load files.

 

With the Loader class.

var file:File = File.applicationDirectory.resolvePath( "image.png" );


var loader:Loader = new Loader();
loader.load( new URLRequest( file.url ) );

Or with FileStream

var file:File = File.applicationDirectory.resolvePath( "image.png" );

var stream:FileStream = new FileStream();
stream.open( file, FileMode.READ );

var bytes:ByteArray = new ByteArray();

stream.readBytes( bytes );

var loader:Loader = new Loader();
loader.loadBytes( bytes );

 

I have found that loading with FileStream can be faster then Loader.load(). It also gives you the option for your loading to be synchronous if you need.