ActionScript 3.0中的Screendump是可能的还是?

Ber*_*nDK 1 actionscript-3 bitmapdata

我们现在有Bitmap和Bitmapdata对象.使用网络摄像头时,我们可以从中获取原始像素数据输出.但是,我们能以某种方式从"舞台"或"swf"对象获取原始像素数据吗?

我想用它来制作Actionscript应用程序某些部分的"小缩略图",这些可能是动态文本,位图图形和动画片段的复杂组合.因此,制作"快速捕捉"并将当前组合像素放入一个位图然后能够"保存以供以后使用"将会很棒.

那可能吗?太容易了吗?我只是在Adobe Docs中找错了地方?

我们在舞台上同时有图像,矢量等,所以我需要抓住"舞台"对象bitmapdata ???

Ama*_*osh 5

创建一个BitmapData并使用相应的draw() 方法调用其方法DisplayObject

var bmpData:BitmapData = new BitmapData(sprite.width, sprite.height, true);
bmpData.draw(sprite);
Run Code Online (Sandbox Code Playgroud)

如果要缩小缩略图,请创建一个MatrixcreateBox使用所需缩放参数调用其方法并将其传递给draw方法.

var bmpData:BitmapData = new BitmapData(thumbW, thumbH, true);
var mat:Matrix = new Matrix();
mat.createBox(thumbW / sprite.width, thumbH / sprite.height);
bmpData.draw(sprite, mat);
Run Code Online (Sandbox Code Playgroud)