Actionscript 3 Actionscript 3.0让air在iDevice上进行屏幕拍摄
我想知道如何用ActionScript3截屏并保存到iPad,我的代码适用于adobe flash player和android平板电脑。然而,它在iPad上不起作用。有什么建议吗Actionscript 3 Actionscript 3.0让air在iDevice上进行屏幕拍摄,actionscript-3,air,Actionscript 3,Air,我想知道如何用ActionScript3截屏并保存到iPad,我的代码适用于adobe flash player和android平板电脑。然而,它在iPad上不起作用。有什么建议吗 /** * ScreenCapture * * This function take the abliity to print screen the stage and ready to output to the user to view * */ package actions{ impor
/**
* ScreenCapture
*
* This function take the abliity to print screen the stage and ready to output to the user to view
*
*/
package actions{
import flash.errors.IllegalOperationError;
import flash.errors.MemoryError;
import flash.net.FileReference;
import flash.display.MovieClip;
import flash.events.IOErrorEvent;
import flash.display.BitmapData;
import flash.utils.ByteArray;
import flash.display.Sprite;
import com.adobe.images.JPGEncoder;
import utility.Base64;
public class ScreenCapture extends Sprite{
public function ScreenCapture() {
}
/**
* saveImage
*
* Seek into the container and find how many child is in the container
*
* @param image the movieclip about to be print screened
* @param imageName the number of the image file
*/
public function saveImage(type:String, image:MovieClip, imageName:String) {
//try {
var jpgSource:BitmapData = new BitmapData( image.width, image.height );
jpgSource.draw(image);
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
if(type == 'fileSave'){
var file:FileReference = new FileReference();
//file.addEventListener( IOErrorEvent.IO_ERROR, ioErrorHandler );
file.save( jpgStream, imageName );
}else if(type == 'fetchImg'){
return jpgStream;
}
//}
/**catch( ioe:IllegalOperationError ) {
trace("Illegal operation.");
}
catch( ae:ArgumentError ) {
trace("Invalid argument.");
}
catch( me:MemoryError ) {
trace("Insufficient memory.");
}
catch( error:Error ) {
trace("Error trying to save image : " + imageName
+ " . Error : " + error);
}*/
}
/**
* Handles IOErrors.
*/
/**private function ioErrorHandler( event:IOErrorEvent ) : void {
trace("ioErrorHandler: " + event);
}*/
}
}
任何帮助或建议都将不胜感激。谢谢找到解决方案CameraRoll是我需要的课程 有趣的是,只是为了确认,当type='fileSave'或type='fetchImg'时,哪个部分会失败?我有一个'fetchImg',它可以获取二进制文件并发送到服务器,上面的代码可以与android设备一起工作,但不能与idevice一起工作,只是想知道我必须做什么,或者idevice不支持文件引用