Quantcast
Channel: Adobe Community : Unanswered Discussions - AIR Development
Viewing all articles
Browse latest Browse all 2010

Unable to use iOS CameraRoll and browseForImage with Air 15

$
0
0

If I publish with Air 14.0.0.137 it works works just fine, but when I test Air 15.0.0.302 (or Air 15.0.0.289) it's crashing.

I'm testing the following code and it's not working with AIR 15, Flash CC.

The app crashes on the device (as did my original code, hence my testing :).

I've tested on an iPhone 6 and an iPhone 5, both iOS 8.02, only using newly taken photos.

 

I need to use AIR 15 in my app so I'm pretty much stuck right now.

 

 

// air 14.0.0.137 WORKING (but can't be uploaded in Application Loader)

// air 15.0.0.289 NOT WORKING
// air 15.0.0.302 NOT WORKING

package
{
     import flash.display.Bitmap;     import flash.display.BitmapData;     import flash.display.Loader;     import flash.display.Sprite;     import flash.display.StageAlign;     import flash.display.StageScaleMode;     import flash.events.Event;     import flash.events.IOErrorEvent;     import flash.events.MediaEvent;     import flash.media.CameraRoll;     import flash.media.MediaPromise;     public class main extends Sprite     {          public var imgLoader:Loader;          public var cam:CameraRoll;          public var promise:MediaPromise;          public function main()          {               // support autoOrients               stage.align = StageAlign.TOP_LEFT;               stage.scaleMode = StageScaleMode.EXACT_FIT;               cam = new CameraRoll();               cam.browseForImage();               cam.addEventListener(MediaEvent.SELECT,onSelect);          }          public function onSelect(e:MediaEvent):void{               promise =  e.data as MediaPromise               addToStage();          }          public function addToStage():void {               imgLoader = new Loader();               imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,drawBitmap);               imgLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandlerIOErrorEventHandler);               imgLoader.loadFilePromise(promise);          }          protected function errorHandlerIOErrorEventHandler(event:Event):void          {               trace("here");          }          public function drawBitmap(e:Event):void{               var myBitmapData:BitmapData = new BitmapData(200,200);               var image:Bitmap = new Bitmap(myBitmapData);               image.bitmapData = Bitmap(e.currentTarget.content).bitmapData               image.width = image.height = 200               image.x = image.y = 50               addChild(image);          }     }
}

Viewing all articles
Browse latest Browse all 2010

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>