使用AIR for Android和as3制作Android应用程序。以下是我将图像保存到设备库中的代码。图像被保存但我想在图像保存时显示加载器。这段代码不适用。如果我在这里犯了错误,请指出。
mysaveBtn.addEventListener(MouseEvent.CLICK, ftnSave);
function ftnSave():void
{
mysaveBtn.removeEventListener(MouseEvent.CLICK, ftnSave);
mysaveBtn.visible = false;
var jpgSource:BitmapData = new BitmapData(1080, 1920);
jpgSource.draw(myTheme);
var jpgEncoder:JPGEncoder = new JPGEncoder(100);
var imgByteData:ByteArray = jpgEncoder.encode(jpgSource);
var fs : FileStream = new FileStream();
var targetFile : File = File.desktopDirectory.resolvePath('/sdcard/DCIM/Camera/image.jpg');
fs.open(targetFile, FileMode.WRITE);
fs.writeBytes(imgByteData);
fs.close();
if( CameraRoll.supportsAddBitmapData ){
new CameraRoll().addBitmapData(jpgSource);
mysaveBtn.visible = true;
mysaveBtn.addEventListener(MouseEvent.CLICK, ftnSave);
}
}