All pastes #501856 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-22 07:41 UTC
rendered paste body
import mx.utils.Delegate
class Draw2 {
	var isPainting:Boolean;
	var theBrush:Object;
	private var mc:MovieClip;
	public function Draw2() {};
	
	public function DrawNow (target:MovieClip, depth:Number) {
		theBrush = new Object ();
		mc = target.createEmptyMovieClip ("painting" + depth, depth);
		trace (mc);
		theBrush.onMouseDown = Delegate.create(this,mouseDown);
		theBrush.onMouseUp = Delegate.create(this,mouseUp);
		theBrush.onMouseMove = Delegate.create(this,mouseMove);
		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;
		};

}