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
Contributor
Posts: 39
Registered: ‎06-13-2011
My Device: playbook, torch 9810 and Alpha device!
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?

Developer
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course

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
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

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.
Contributor
Posts: 39
Registered: ‎06-13-2011
My Device: playbook, torch 9810 and Alpha device!

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?

Developer
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course

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
Contributor
Posts: 39
Registered: ‎06-13-2011
My Device: playbook, torch 9810 and Alpha device!

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?

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

Re: Accessing all of the local images

Just use the camera folder as your root folder to scan.
Contributor
Posts: 39
Registered: ‎06-13-2011
My Device: playbook, torch 9810 and Alpha device!

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.

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

Re: Accessing all of the local images

/shared/camera
Contributor
Posts: 39
Registered: ‎06-13-2011
My Device: playbook, torch 9810 and Alpha device!

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?