flash as2 BitmapData应用之 ---- 画双线
//根据此例子,可以实现划线带阴影的效果。。。
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
createEmptyMovieClip("draw_mc", -999);
createEmptyMovieClip("mm", -992);
var draw_bit:BitmapData = new BitmapData(Stage.width, Stage.height,true,0x226600);
/**/
var draw_;
//draw_mc._visible = false;
mm._x=mm._y=11;
draw_mc.onMouseMove = function() {
//定义函数
if (draw_) {
draw_mc.lineStyle(4, 0xff0000, 100);
//设置线条粗细、颜色、透明度
draw_mc.lineTo(_xmouse, _ymouse);
draw_bit.draw(draw_mc);
mm.attachBitmap(draw_bit, 1);
}
};
draw_mc.onMouseDown = function() {
draw_ = true;
draw_mc.moveTo(draw_mc._xmouse, draw_mc._ymouse);
};
draw_mc.onMouseUp = function() {
draw_ = false;
};
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.geom.Point;
createEmptyMovieClip("draw_mc", -999);
createEmptyMovieClip("mm", -992);
var draw_bit:BitmapData = new BitmapData(Stage.width, Stage.height,true,0x226600);
/**/
var draw_;
//draw_mc._visible = false;
mm._x=mm._y=11;
draw_mc.onMouseMove = function() {
//定义函数
if (draw_) {
draw_mc.lineStyle(4, 0xff0000, 100);
//设置线条粗细、颜色、透明度
draw_mc.lineTo(_xmouse, _ymouse);
draw_bit.draw(draw_mc);
mm.attachBitmap(draw_bit, 1);
}
};
draw_mc.onMouseDown = function() {
draw_ = true;
draw_mc.moveTo(draw_mc._xmouse, draw_mc._ymouse);
};
draw_mc.onMouseUp = function() {
draw_ = false;
};