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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Contributor
tylorpin
Posts: 39
Registered: ‎06-13-2011
My Carrier: digi
Accepted Solution

Accessing all of the local images

Hello there, I'm trying to make a photo album app, whereby the app will automatically retrieve all of the photos in the camera roll as well as other albums and display it.

 

I've added permission inside the bar-descriptor file and I tried using CameraRoll API which allows user to select an image of their choice, but that isn't what I wanted.

 

Is there any way that I can access the list of image available inside the playbook all at once?

Please use plain text.
Developer
Innovatology
Posts: 1,076
Registered: ‎03-03-2011
My Carrier: Vodafone

Re: Accessing all of the local images

Easiest way is probably to recurively search the shared folder for images using the File object.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
jtegen
Posts: 6,154
Registered: ‎10-27-2010
My Carrier: AT&T

Re: Accessing all of the local images

I would also look at "paging" the images because a user could have a lot of images that trying to display all of them at one time would be very slow.
Please use plain text.
Contributor
tylorpin
Posts: 39
Registered: ‎06-13-2011
My Carrier: digi

Re: Accessing all of the local images

Erm I just want to return a query of file url's inside the playbook, and if let's say the user only want a specific album to be displayed then i'll display the images inside the album randomly.

 

Any sample code which shows how to access the photo album and retrieve the images?

Please use plain text.
Developer
Innovatology
Posts: 1,076
Registered: ‎03-03-2011
My Carrier: Vodafone

Re: Accessing all of the local images

It's simple recursion...

 

private function scan(folder:File):void
{
    var entries:Array = folder.getDirectoryListing();

    for each (var entry:File in entries)
    {
        if (entry.isDirectory)
          scan(entry) // recurse 
        else
          trace(entry.nativePath); // do something else
    }
}

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Contributor
tylorpin
Posts: 39
Registered: ‎06-13-2011
My Carrier: digi

Re: Accessing all of the local images

Great. so far i've successfully navigate under shared/photos/

 

Is it possible to navigate to the camera album of the playbook?

Please use plain text.
Developer
jtegen
Posts: 6,154
Registered: ‎10-27-2010
My Carrier: AT&T

Re: Accessing all of the local images

Just use the camera folder as your root folder to scan.
Please use plain text.
Contributor
tylorpin
Posts: 39
Registered: ‎06-13-2011
My Carrier: digi

Re: Accessing all of the local images

can explain somemore? because i saw this article explaining file layout http://supportforums.blackberry.com/t5/Adobe-AIR-Development/BlackBerry-PlayBook-File-System-Layout/... it only mention the file directory that can be navigate is under shared/album.

Please use plain text.
Developer
jtegen
Posts: 6,154
Registered: ‎10-27-2010
My Carrier: AT&T

Re: Accessing all of the local images

/shared/camera
Please use plain text.
Contributor
tylorpin
Posts: 39
Registered: ‎06-13-2011
My Carrier: digi

Re: Accessing all of the local images

Thanks alot! But after I navigated to it, when i try loading my images into it, it shows up URL not found on the log.

 

var imageLoader:Loader=new Loader();
			imageLoader.load(new URLRequest("shared/camera/IMG_00000528.jpg"));

 it seems like the URLReq's root file is under app/air. isit possible to change the root of URL to shared/ or using URLReq to navigate up one folder?

Please use plain text.