rendered paste bodyimport 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() {
this.isPainting = true;
mc.moveTo (_xmouse, _ymouse);
trace (mc.moveTo ());
mc.lineTo (_xmouse + 1, _ymouse + 1);
mc.lineStyle (2, 300, 100);
}
public function onMouseMove () {
if (isPainting) {
mc.lineTo (_xmouse, _ymouse);
}
};
public function onMouseUp () {
this.isPainting = false;
};
}