// Video Clips named mc_bursh/mc_earse must be placed on the current layer of the stage.
// Friendly reminder. In this example, there is something irrelevant to the page presentation.Code, But it does not affect the actual function. You can delete it as needed when using it!
Import Flash. display. bitmapdata;
Import Flash. Geom. rectangle;
Import Flash. Geom. Point;
VaR Tools = "bursh ";
VaR Widthh = 1200;
VaR Base_point: Point = new point (0, 0 );
VaR Base_rectangle: rectangle = new rectangle (0, 0, 25, 25 );
VaR Bit1: bitmapdata = new bitmapdata (widthh, 768, False , 0xff0000 );
VaR Org_bit: bitmapdata = new bitmapdata (widthh, 768, True , 0 );
Org_bit.draw (bit1 );
VaR Draw_bit: bitmapdata = org_bit.clone ();
Createemptymovieclip ("draw_mc",-999 );
Createemptymovieclip ("mc1", 2 );
Createemptymovieclip ("mc2", 3 );
Createemptymovieclip ("MC3", 4 );
Drawcircle (mc1, 40, 40, 40, 0x000000 );
Drawcircle (MC2, 4, 4, 4, 0x000000 );
Mc1. _ visible = mc2. _ visible = mc3. _ visible = False ;
Draw_mc.attachbitmap (draw_bit, 1 );
VaR Erase_bit: bitmapdata = new bitmapdata (mc1. _ width, mc1. _ height, True , 0 );
VaR Redraw_bit: bitmapdata = new bitmapdata (mc2. _ width, mc2. _ height, True , 0 );
Erase_bit.fillrect (erase_bit.rectangle, 0 xffffffff );
Erase_bit.draw (mc1 );
Redraw_bit.draw (MC2 );
Erase_bit.copychannel (erase_bit, erase_bit.rectangle, new point (0, 0), 1, 8 );
VaR Tools: String ;
Earse_first ();
Mc_bursh.onrelease = Function (){
This. gotoandstop (2 );
Mc_earse.gotoandstop (1 );
Tools = "bursh ";
};
Mc_earse.onrelease = Function (){
This. gotoandstop (2 );
Mc_bursh.gotoandstop (1 );
Tools = "easre ";
};
Draw_mc.onpress = Function (){
If (Tools = "bursh "){
Trace (1 );
Mc3.moveto (mc3. _ xmouse, mc3. _ ymouse );
This. onmousemove = bursh_pic;
}
If (Tools = "easre "){
This. onmousemove = earse_pic;
}
};
Draw_mc.onrelease = draw_mc.onreleaseoutside = Function (){
Delete This. onmousemove;
};
Function Earse_pic (){
Mc3.clear (); VaR Now_rect: rectangle = new rectangle (_ xmouse-mc1. _ width/2, _ ymouse-mc1. _ width/2, _ xmouse + base_rectangle.width, _ ymouse + base_rectangle.height );
Draw_bit.copypixels (draw_bit, now_rect, new point (_ xmouse-mc1. _ width/2, _ ymouse-mc1. _ width/2), erase_bit, new point (0, 0 ), False );
Updateafterevent ();
}
Function Earse_first (){
VaR Now_rect: rectangle = new rectangle (0, 0, widthh, 768 );
Draw_bit.copypixels (draw_bit, now_rect, new point (0, 0), new bitmapdata (widthh, 768, True , 0x0), new point (0, 0 ), False );
Updateafterevent ();
}
Function Bursh_pic (){
Trace (MC3 );
Mc3.linestyle (8, 0xff0000, 100 );
Mc3.lineto (mc3. _ xmouse, mc3. _ ymouse );
Draw_bit.draw (MC3 );
Draw_mc.attachbitmap (draw_bit, 1 );
// VaR now_rect: rectangle = new rectangle (_ xmouse, _ ymouse, _ xmouse + base_rectangle.width, _ ymouse + base_rectangle.height );
// Draw_bit.copypixels (org_bit, now_rect, new point (_ xmouse-mc2. _ width/2, _ ymouse-mc2. _ width/2), redraw_bit, new point (0, 0), true );
// Updateafterevent ();
}
Function Drawcircle (MC: Movieclip , X: Number , Y: Number , R: Number , Color: Number ): Void {
MC. beginfill (color );
MC. moveTo (x + R, y );
MC. curveto (R + X, math. tan (math. PI/8) * R + Y, math. sin (math. PI/4) * R + X, math. sin (math. PI/4) * R + y );
MC. curveto (math. Tan (math. PI/8) * R + X, R + Y, X, R + y );
MC. curveto (-math. tan (math. PI/8) * R + X, R + Y,-math. sin (math. PI/4) * R + X, math. sin (math. PI/4) * R + y );
MC. curveto (-R + X, math. Tan (math. PI/8) * R + Y,-R + x, y );
MC. curveto (-R + X,-math. tan (math. PI/8) * R + Y,-math. sin (math. PI/4) * R + X,-math. sin (math. PI/4) * R + y );
MC. curveto (-math. Tan (math. PI/8) * R + X,-R + Y, X,-R + y );
MC. curveto (math. tan (math. PI/8) * R + X,-R + Y, math. sin (math. PI/4) * R + X,-math. sin (math. PI/4) * R + y );
MC. curveto (R + X,-math. Tan (math. PI/8) * R + Y, R + x, y );
MC. endfill ();
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.