import mx.utils.Delegate class Draw2 { var isPainting:Boolean; var theBrush:Object; private var mc:MovieClip; public function Draw2() { theBrush.onMouseDown = Delegate.create(this,mouseDown); theBrush.onMouseUp = Delegate.create(this,mouseUp); theBrush.onMouseMove = Delegate.create(this,mouseMove); }; public function DrawNow (target:MovieClip, depth:Number) { theBrush = new Object (); mc = target.createEmptyMovieClip ("painting" + depth, depth); trace (mc); Mouse.addListener (theBrush); } public function onMouseDown() : void { this.isPainting = true; mc.moveTo (_xmouse, _ymouse); trace (mc.moveTo ()); mc.lineTo (_xmouse + 1, _ymouse + 1); mc.lineStyle (2, 300, 100); } public function onMouseMove () : void { if (isPainting) { mc.lineTo (_xmouse, _ymouse); } }; public function onMouseUp () : void { this.isPainting = false; }; }