0

我最近将 AIR 3.7 覆盖到 Flex 4.9.1 SDK 中。我创建的一个 iOS 应用程序与 3.4(我创建它)完美配合。该应用程序的一部分是拍照或从相机胶卷中获取它(并保存压缩版本)但是,在 3.7 中,一旦调用 MediaEvent.Complete 代码,应用程序就会挂起(代码如下)任何想法,我需要添加加载程序上下文?

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;
        }
4

1 回答 1

2

好的,所以问题不在于我的代码。事实上,当我覆盖 AIR 3.7 时,air-config.xml、flex-config.xml 和 airmobile-config.xml 的文件仍然针对的 Flash 播放器版本太低。它是 11.1 和 swf 版本 14。

它应该分别是 11.5 和 18。一旦我更改了这些文件,它就完美地工作了!

于 2013-05-07T01:10:30.527 回答