All pastes #501795 Raw Edit

motion

public text v1 · immutable
·published 2007-05-22 06:40 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 = function () {
            target.isPainting = true;
            trace(target.isPainting);
            mc.moveTo (_xmouse, _ymouse);
            mc.lineTo (_xmouse + 1, _ymouse + 1);
            mc.lineStyle (1, 100, 100);
        };
        theBrush.onMouseMove = function () {
            
            if (target.isPainting) {
                mc.lineTo (_xmouse, _ymouse);
            }
        };
        theBrush.onMouseUp = function () {
            trace(target.isPainting);
            target.isPainting = false;
        };
        Mouse.addListener (theBrush);
    }
    
}