必备的知识:
draw(BitmapData.draw 方法)
使用 Flash Player 矢量呈现器在目标图像上绘制源图像或影片剪辑。您可以使用 Matrix、ColorTransform、BlendMode 对象以及目标 Rectangle 对象来控制呈现的执行方式。或者,您也可以指定缩放时是否应对位图进行平滑处理。这只适用于当源对象是 BitmapData 对象时的情况。
此方法直接与如何在创作工具界面中使用对象的标准矢量呈现器来绘制图像相对应。
源 MovieClip 对象不对此调用使用其任何舞台中转换。该源 MovieClip 对象会被视为存在于库或文件中,没有矩阵转换、没有颜色转换,也没有混合模式。如果您希望通过使用影片剪辑自身的 transform 属性来绘制影片剪辑,则可以使用它的 Transform 对象来传递各种 transformation 属性。
可用性:ActionScript 1.0;Flash Player 8
参数
source:Object - 要绘制的 BitmapData 对象。
matrix:flash.geom.Matrix [可选] - 一个 Matrix 对象,用于缩放、旋转或转换位图的坐标。如果没有提供任何对象,位图图像将不转换。如果您必须传递此参数但又不希望转换图像,则可以将此参数设置为使用默认 new Matrix() 构造函数创建的恒等矩阵。
colorTransform:flash.geom.ColorTransform [可选] - 一个 ColorTransform 对象,用于调整位图的颜色值。如果没有提供任何对象,位图图像的颜色将不转换。如果您必须传递此参数但又不希望转换图像,则可以将此参数设置为使用默认 new ColorTransform() 构造函数创建的 ColorTransform 对象。
blendMode:Object [可选] - 一个 BlendMode 对象。
clipRect:flash.geom.Rectangle [可选] 一个 Rectangle 对象。如果您未提供此值,将不发生任何剪裁。
smooth:Boolean [可选] - 布尔值,确定缩放时是否要对 BitmapData 对象进行平滑处理。默认值为 false。
代码如下:
//库里有两个元件,一个图像cool,一个图形mc_2
import flash.display.*;
import flash.geom.*;
size_w=550;
size_h=400;
var basepoint = new flash.geom.Point(0,0);
var tempbmp = flash.display.BitmapData.loadBitmap("cool");
mc=_root.createEmptyMovieClip("t_mc",getNextHighestDepth())
ma = new flash.display.BitmapData(size_w,size_h)
juxing=new flash.geom.Rectangle(0,0,size_w,size_h)
ma.copyPixels(tempbmp,juxing, basepoint);
t_mc.attachBitmap(ma,getNextHighestDepth())
this.attachMovie("mc_2", "mc_2", this.getNextHighestDepth(), {_x:200, _y:100});
var myMatrix:Matrix = new Matrix();
var translateMatrix:Matrix = new Matrix();
translateMatrix.translate(200, 15);
myMatrix.concat(translateMatrix);
var myColorTransform:ColorTransform = new ColorTransform(0, 0, 1,0.5, 255, 255, 255, 0);//设置颜色、透明度
var blendMode:String = "normal";//设置混合类型
var myRectangle:Rectangle = new Rectangle(0, 0, 500, 300);//设置区域大小
var smooth:Boolean = true;
t_mc.onPress = function() {
mc_2._visible=false;
ma.draw(mc_2, myMatrix, myColorTransform, blendMode, myRectangle, smooth);
}

