I have an application developed in Adobe AIR and compiled using Flex SDk 4.6 for iOS. The application have a module where user can save the current screen to the appstorage. This is working fine but it takes around 6-8 seconds to save the image.
I am using bitmapdata to draw the stage and then use jpgencoder to convert it to bytearray and then save it to the appstorage using File reference.
Can somebody please let me know if this is the correct and only way to capture image or there are better alternatives of this when it comes to AIR on iOS?
Here is my code
var bmp:BitmapData = new BitmapData(640,960,false,0)
bmp.draw(this);
//
var je:JPGEncoder = new JPGEncoder();
var b:ByteArray = je.encode(bmp);
var saveFileName = String( new Date().milliseconds ) + ".jpg";
var cropFile:File = appDir.resolvePath(saveFileName)
var stream = new FileStream();
stream.open(cropFile, FileMode.WRITE);
stream.writeBytes(b,0,b.bytesAvailable);
stream.close();
bmp.dispose();
For those looking for a solution please go to http://www.labs.saachitech.com/2012/10/12/capture-image-on-a-adobe-ios-application-and-save-to-ios-device-disk/ and download swc and ane files for faster bitmap data saving on an iOS device.