答案 0 :(得分:-1)
您需要为保存按钮命名,并为其添加点击监听器。
// create the BitmapData that you'll be drawing to, give it the same dimensions
var savedImage:BitmapData = new BitmapData(holder.width, holder.height, false, 0xFFFFFF);
// add a click listener to your save button
saveBtn.addEventListener(MouseEvent.CLICK, onSave);
function onSave(event:MouseEvent):void
{
// need to apply a transformation matrix because holder's origin is centered
var matrix:Matrix = new Matrix();
matrix.translate(holder.width * .5, holder.height * .5);
// clear out any existing image on savedImage
savedImage.fillRect(savedImage.rect, 0xFFFFFF);
// draw the holder onto the savedImage bitmapdata, using the transform matrix
savedImage.draw(holder, matrix, null, null, null, true);
}
从那里开始,您可以将savedImage
BitmapData
传递给Bitmap
个实例:
var savedBitmap:Bitmap = new Bitmap(savedImage);
只要savedBitmap
在正确的范围内,您就可以将其添加到另一帧的显示列表中:
addChild(savedBitmap);