Ios 在Adobe AIR中将特定电影剪辑写入位图

Ios 在Adobe AIR中将特定电影剪辑写入位图,ios,actionscript-3,air,screenshot,Ios,Actionscript 3,Air,Screenshot,我正在AdobeAIR中为iOS开发一个游戏,我想拍摄一个屏幕截图(或屏幕特定部分/电影剪辑的位图捕获)。我已经读到,使用本机扩展可以拍摄屏幕截图,但实际上我并不需要整个屏幕,我只需要Adobe AIR中特定电影剪辑(或屏幕区域,如果可能)的位图表示。我不认为我需要访问本机SDK来实现这一点,但我找不到任何资源来实现我正在尝试的目标 如何在Adobe AIR中保存电影剪辑的“位图快照”,而不使用本机扩展名 谢谢 可以。如果您只需要air应用程序中的内容快照(例如MovieClip/其他Displ

我正在AdobeAIR中为iOS开发一个游戏,我想拍摄一个屏幕截图(或屏幕特定部分/电影剪辑的位图捕获)。我已经读到,使用本机扩展可以拍摄屏幕截图,但实际上我并不需要整个屏幕,我只需要Adobe AIR中特定电影剪辑(或屏幕区域,如果可能)的位图表示。我不认为我需要访问本机SDK来实现这一点,但我找不到任何资源来实现我正在尝试的目标

如何在Adobe AIR中保存电影剪辑的“位图快照”,而不使用本机扩展名

谢谢


可以。

如果您只需要air应用程序中的内容快照(例如MovieClip/其他DisplayObject),您可以使用BitmapData的方法:

e、 g


如果您只需要air应用程序中的内容快照(例如MovieClip/other DisplayObject),您可以使用BitmapData的方法:

e、 g


在.swf或.mp4中的电影剪辑?在swf中的常规flash movieclip对象。在.swf中的电影剪辑或在swf中的.mp4?常规flash movieclip对象。
/*
* getSnapshot - simple snapshot of a DisplayObject
* @param matrix - the transformation matrix of the object to be drawn(translation/rotation/scale)
*                 use this parameter to include the object's tranformations or an arbitrary one. 
*                 Ex. getSnapshot(myClip,myClip.transform.concatenatedMatrix);
* @param coordinateSpace - the coordinate space from used to get bounds. if you're object's rotated, 
*                          the by passing null, the bitmap will include all contents, otherwise it will be
*                          clipped using the original/'unrotated' bounds.
*/
function getSnapshot(obj:DisplayObject,matrix:Matrix = null,coordinateSpace:DisplayObject = null):BitmapData{
    var bounds:Rectangle = obj.getBounds(coordinateSpace);
    var result:BitmapData = new BitmapData(bounds.width,bounds.height,true,0x00FFFFFF);
    result.draw(obj,matrix);
    return result;
}
var test:Shape = addChild(new Shape()) as Shape;
test.graphics.beginFill(0);test.graphics.drawRect(0,0,100,100);test.graphics.endFill();

var snapShot:Bitmap = addChild(new Bitmap(getSnapshot(test))) as Bitmap;
snapShot.x = test.width+10;

function getSnapshot(obj:DisplayObject,matrix:Matrix = null,coordinateSpace:DisplayObject = null):BitmapData{
    var bounds:Rectangle = obj.getBounds(coordinateSpace);
    var result:BitmapData = new BitmapData(bounds.width,bounds.height,true,0x00FFFFFF);
    result.draw(obj,matrix);
    return result;
}