Search code examples
mobileios4airflash-builder4.5

How do you access the iOS Camera Roll from a flex mobile project?


I want to use FlashBuilder 4.5.1 to build a flex mobile project that lets me select multiple photos from the iPhone Camera Roll.

I've seen the flash.media.CameraRoll class, but it only seems to provide CameraRoll.browseForImage() that opens a dialog to pick ONE photo.

Does flex mobile allow something like this:

// is this a security violation?
var cameraRoll:File = new File('/var/mobile/Media/DCIM');

var photos:Array = [];
var folders:Array = cameraRoll.getDirectoryListing();
for (var i:int=0 ; i<folders.length; i++) {
    var files:Array = folders[i].getDirectoryListing();
    for (var j:int=0 ; j<files.length; j++) {
        var photo:File = files[j];
        photos.push(photo);
    }
}
// show photos, somehow...

However, this method does not provide access to thumbnails managed by: '/var/mobile/User/Media/Photos/Photo Database'

Is there another way to do this?

PS: I'd try this on my iPhone, but I'm still waiting for my iOS development certificate.


Solution

  • Oddly, I don't think your code is an explicit security violation. I do think it would get your app rejected by Apple, though. It seems that the iOS file system is protected, at least in part, by policy rather than security (based on conversations I've had with other developers).