All pastes #501834 Raw Edit

Stuff

public text v1 · immutable
·published 2007-05-22 07:12 UTC
rendered paste body
class Draw2 extends MovieClip {
    var isPainting:Boolean;
    var theBrush:Object;
	private var mc:MovieClip;
    public function Draw2 (target:MovieClip, depth:Number) {
		theBrush = new Object ();
        mc = target.createEmptyMovieClip ("painting" + depth, depth);
       trace(mc)
        theBrush.onMouseDown = mouseDown;
        theBrush.onMouseMove = mouseMove;
        theBrush.onMouseUp = mouseUp;
        };
        Mouse.addListener (theBrush);
    }
    public Function mouseDown():void {
            this.isPainting = true;
            trace(this.isPainting);
            mc.moveTo (_xmouse, _ymouse);
            mc.lineTo (_xmouse + 1, _ymouse + 1);
            mc.lineStyle (1, 100, 100);
    }

    public Function mouseMove():void {
            if (this.isPainting) {
                mc.lineTo (_xmouse, _ymouse);
            }
    }
    
    public Function mouseUp():void {
            trace(this.isPainting);
            this.isPainting = false;
    }
}