0

I am interested in saving an image file to Playbook photos folder. By using documentsDirectory i am able to save my file into documents. But native pictures app of playbook doesn't show images which are in documents directory , I need to show my images in Pictures directory like Scrapbook save images in photos. photos->scrapbook->(all images created in Scrapbooks ) by which it can be shown in native pictures app of playbook.

How can i do so?

Shashank Agarwal
  • 512
  • 3
  • 12

2 Answers2

0

I think you want to use the CameraRoll class. From the docs:

The CameraRoll.addBitmapData() method adds an image to the device's dedicated media library. To check at run time whether your application supports the CameraRoll.addBitmapData() method, check the CameraRoll.supportsAddBitmapData property.

The CameraRoll.browseForImage() method opens an image-choosing dialog that allows a user to choose an image in the media library. When the user selects an image, the CameraRoll object dispatches a select event. Use the MediaEvent object dispatched for this event to access the chosen image. To check at run time whether your application supports the CameraRoll.browseForImage() method, check the CameraRoll.supportsBrowseForImage property.

Community
  • 1
  • 1
Sunil D.
  • 17,983
  • 6
  • 53
  • 65
  • CameraRoll Allows me to save image in jpg format , & it degrades the quality & it saves it to Camera directory but i want to save my file in png Format for having transparency by using PNGEncoder class , By using CameraRoll.addBitmapData() , it also wont allow me to named the file. – Shashank Agarwal Aug 11 '12 at 05:38
  • :-) .. yeah but i am asking to save an image file to photos folder , rather than saving its bitmapData. – Shashank Agarwal Aug 11 '12 at 05:43
0

I did it...

var imgStr : String = title + ".jpg";
var imgFile : File = new File("/accounts/1000/shared/photos/Custom folder/" + imgStr);

It will allow you to save image in photos directory.

Thanks All for your Support.

Shashank Agarwal
  • 512
  • 3
  • 12
  • You should *never* have to use an absolute path like that in the PlayBook. Your app's current directory is always in the sandbox folder, where there's a symbolic link to the shared folder. Use that, as a relative path, so you would have File("shared/photos...") instead (note: without a leading slash!). – Peter Hansen Aug 11 '12 at 15:50
  • I tried just using File("shared/photos/Folder name/" + imgStr); i got an error of ArgumentError: Error #2004: One of the parameters is invalid. at Error$/throwError() at flash.filesystem::File/set nativePath() at flash.filesystem::File() – Shashank Agarwal Aug 11 '12 at 16:04
  • Shashank, the subfolder "Folder name" would have to exist for that to work. Assuming you it does exist, another problem may be that you need "access_shared" permission set in your bar-descriptor.xml file (or, rather, in the resulting MANIFEST.MF file in your .bar) to access any shared folders. Do you have that set too? – Peter Hansen Aug 31 '12 at 21:58