Bitmapdata 截圖

import flash.events.MouseEvent;
import flash.display.BitmapData;
import flash.geom.Point;
import flash.display.MovieClip;
import flash.geom.Rectangle;

mask_mc.addEventListener(MouseEvent.MOUSE_DOWN,OnMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,OnMouseUp);
function OnMouseDown(evt:MouseEvent)
{
    mask_mc.startDrag(false,new Rectangle(source_mc.x,source_mc.y,source_mc.width-mask_mc.width,source_mc.height-mask_mc.height));
}
function OnMouseUp(evt:MouseEvent)
{
    mask_mc.stopDrag();
    getThumbnail();
}

function getThumbnail()
{
    var nX:Number = source_mc.x - mask_mc.x;
    var nY:Number = source_mc.y - mask_mc.y;
    var pt:Point = new Point(mask_mc.x,mask_mc.y);
    pt = source_mc.globalToLocal(pt);
    var nW:Number = mask_mc.width;
    var nH:Number = mask_mc.height;
    var rect:Rectangle = new Rectangle(pt.x,pt.y,nW,nH);

    var bitmapdata:BitmapData = new BitmapData(nW,nH);
    var bitmapdataSource:BitmapData=new BitmapData(source_mc.width,source_mc.height);
    bitmapdataSource.draw(source_mc);
    
    bitmapdata.copyPixels(bitmapdataSource, rect, new Point(0, 0));

    if (getChildByName("bmp") != null)
    {
        removeChild(getChildByName("bmp"));
    }
    var bitmap:Bitmap = new Bitmap(bitmapdata);
    bitmap.name = "bmp";
    bitmap.x = source_mc.x + source_mc.width;
    bitmap.y = source_mc.y + source_mc.height - bitmap.height;
    this.addChild(bitmap);
}

參考資料