All pastes #501875 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-22 07:53 UTC
rendered paste body
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;
	}
}