flash on 2009-5-11 M4RC0 forked:0favorite:0lines:27license : All rights reserved modified : 2009-05-11 05:08:02 Embed Tweet package { import flash.display.Sprite; import flash.events.MouseEvent; public class essai extends Sprite { private var Layer:Sprite=new Sprite() public function essai() { Layer.graphics.beginFill(0x00FF00); Layer.graphics.drawRect(50,50,100,100); addChild(Layer); graphics.beginFill(0xFF0000); graphics.drawCircle( 100, 100, 100 ); stage.addEventListener(MouseEvent.MOUSE_MOVE, draw); stage.addEventListener(MouseEvent.CLICK,erase); } public function erase(event:MouseEvent):void { removeChild(Layer); } public function draw(event:MouseEvent):void { graphics.beginFill(Math.random() * 0xFFFFFF); graphics.drawCircle( mouseX, mouseY, Math.random()*10 ); } } } Code Fullscreen Preview Fullscreen MouseEvent addEventListener removeChild MouseEvent.MOUSE_MOVE mouseY mouseX MouseEvent.CLICK addChild Math.random Sprite