我最近将AIR 3.7重叠到Flex 4.9.1 SDK中。我创建的iOS应用程序与3.4(我用它创建)完美配合。应用程序的一部分是拍照或从相机胶卷中获取(并保存压缩版本)但是,在3.7中,一旦调用MediaEvent.Complete代码,应用程序挂起(代码如下)任何想法,我需要添加一个loadercontext?
protected function onComplete(event:MediaEvent):void {
//Busy Indicator
bi = new UploadAlert(); //upload Alert is a component I created to display a Busy indicator
bi.x = this.width/2 - 150;
bi.y = this.height/2 - 150;
//Get number of elements
allElements = this.numElements;
this.addElementAt(bi, allElements);
var cameraUI:CameraUI = event.target as CameraUI;
var mediaPromise:MediaPromise = event.data;
var mpLoader:Loader = new Loader();
mpLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMediaPromiseLoaded);
mpLoader.loadFilePromise(mediaPromise);
}
private function onMediaPromiseLoaded(e:Event):void
{
var mpLoaderInfo:LoaderInfo = e.target as LoaderInfo;
mpLoaderInfo.removeEventListener(Event.COMPLETE, onMediaPromiseLoaded);
this.imageProblem.source = mpLoaderInfo.loader;
var bitmapDataA:BitmapData = new BitmapData(mpLoaderInfo.width, mpLoaderInfo.height);
bitmapDataA.draw(mpLoaderInfo.content,null,null,null,null,true);
var bitmapDataB:BitmapData = resizeimage(bitmapDataA, int(mpLoaderInfo.width / 4), int(mpLoaderInfo.height/ 4)); // function to shrink the image
var c:CameraRoll = new CameraRoll();
c.addBitmapData(bitmapDataB);
var now:Date = new Date();
var f:File = File.applicationStorageDirectory.resolvePath("IMG" + now.seconds + now.minutes + ".jpg");
var stream:FileStream = new FileStream()
stream.open(f, FileMode.WRITE);
// Then had to redraw and encode as a jpeg before writing the file
var bytes:ByteArray = new ByteArray();
bytes = bitmapDataB.encode(new Rectangle(0,0, int(mpLoaderInfo.width / 4) , int(mpLoaderInfo.height / 4)), new JPEGEncoderOptions(80), bytes);
stream.writeBytes(bytes,0,bytes.bytesAvailable);
stream.close();
imagefile = f;
deleteFlag = 1;
this.removeElementAt(allElements);
this.btnRotate.enabled = true;
this.btnDelete.enabled = true;
}
答案 0 :(得分:2)
好的,问题不在于我的代码。事实上,当我覆盖AIR 3.7时,air-config.xml,flex-config.xml和airmobile-config.xml的文件仍然是目标版本太低的flash播放器。它是11.1和swf版本14。
它应该分别是11.5和18。一旦我更改了这些文件,它就能完美运行!