myPencil.addEventListener(MouseEvent.CLICK, holdPencil);function holdPencil(event:MouseEvent):void{stage.addEventListener(MouseEvent.MOUSE_MOVE, drawing);trace("已单击鼠标");//myPencil.removeEventListener(MouseEvent.CLICK, holdPencil);}function drawing(event:MouseEvent):void{stage.addEventListener(MouseEvent.MOUSE_UP,
endDrawing);if (event.buttonDown){var myDot:dot=new dot();myDot.x = mouseX-myDot.width/2;myDot.y = mouseY-myDot.width/2;addChild(myDot);}}function endDrawing(event:MouseEvent):void{stage.removeEventListener(MouseEvent.MOUSE_UP, endDrawing);}
用flashCS6写的制作画板的代码
本文介绍如何通过Event监听机制实现绘图功能,包括单击、移动和释放鼠标的操作,详细展示了事件处理过程和代码实现。

被折叠的 条评论
为什么被折叠?



