I'm finally trying to port my Flash games to apps, starting with iOS. I'm stuck on the image saving functionality. In swf's, I used jpegencoder to save to the desktop server. It seemed with some research that that code should still work on mobile, so I tried it, but it doesn't seem to do anything when testing on an iPhone from Adobe AIR (the button registers a click but there is no image that can be found, no notification of anything happening, no asking for permission to access images etc). This is the old code:
saveToDisc.addEventListener(MouseEvent.CLICK, saveToDiscSave);
function saveToDiscSave(e:MouseEvent):void {
this.visible = false; //hides menu
var bitmapData:BitmapData = new BitmapData(1242,1864);
bitmapData.draw(MovieClip(root));
var jpgEncoder:JPGEncoder = new JPGEncoder(80);
var byteArray:ByteArray = jpgEncoder.encode(bitmapData);
var fileReference:FileReference=new FileReference();
fileReference.save(byteArray, "Dinogeddon-DollDivine.jpg");
//this.visible = true; //returns menu. commented out to see if click registered
}
So with more research, I found the CameraRoll code which looked simple and like it's made specifically for iOS. So I tried that but I'm having the same issue: no evidence that anything's happening. No image saved, no errors, no permission requests.
saveToDisc.addEventListener(MouseEvent.CLICK, saveToDiscSave);
function saveToDiscSave(e:MouseEvent):void {
this.visible = false;
var cameraRoll:CameraRoll = new CameraRoll();
var bitmapData:BitmapData = new BitmapData(1242,1864);
bitmapData.draw(MovieClip(root));
cameraRoll.addBitmapData(bitmapData);
//this.visible = true;
}
Like, I don't even know where I'm going wrong.. Are apps being in testing mode even able to save images? Should I be expecting a notification of some sort to pop up? Is there a size limit on things being saved to a phone? HALP