Hello,
I slightly modified the drawing tutorial and would like the user to be able to erase just the last line they drew. The code is posted below. I’m tracing the clip name at the time I want to clear() and it all appears to be correct but it isn’t clearing. Hopefully somebody can see the problem. It has to be something simple.
i = -1;
lineColor = 0xFF0000;
_root.onMouseDown = function(){
if (_ymouse >= 385) {
trace("blah i = "+i);
} else {
i += 1;
_global.canvas_var = this.createEmptyMovieClip("line"+i,i);
canvas_var.moveTo(_xmouse,_ymouse);
canvas_var.lineStyle(1,lineColor,100);
trace("current"+canvas_var);
this.onEnterFrame = function(){
canvas_var.lineTo(_xmouse,_ymouse);
}
}
}
_root.onMouseUp = function(){
this.onEnterFrame = null;
}
buttonErase.onRelease = function(){
trace(_global.canvas_var)
_global.canvasVar.clear();
}