Pen tool - On/Off (AS2)

Hey!

I’ve been having a problem for the past month or so, and for the life of me I can’t work out how to switch off the pen tool I have in actionscript.

I have the following code in frame 2, and frame one doesn’t have anything, meaning it doesn’t allow the user to draw. However, after returning to frame 1 from frame 2, you can still draw.

Is there anyway to turn off this drawing actionscript completely when going back to the first frame?

this.attachMovie("cursor_id","cursor_mc",this.getNextHighestDepth(),{_x:_xmouse, _y:_ymouse});
Mouse.hide();
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
pencil._x = _xmouse;
pencil._y = _ymouse;
updateAfterEvent();
};

Mouse.addListener(mouseListener);

this.createEmptyMovieClip("drawing_mc",this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
 this.drawing = true;
drawing_mc.moveTo(_xmouse, _ymouse);
 drawing_mc.lineStyle(3, 0x99CC00, 100);
};

mouseListener.onMouseUp = function() {
this.drawing = false;
};

mouseListener.onMouseMove = function() {
 if (this.drawing) {
drawing_mc.lineTo(_xmouse, _ymouse);
}
updateAfterEvent();
};

Mouse.addListener(mouseListener);

var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.DELETEKEY) || Key.isDown(Key.BACKSPACE)) {
}
};
Key.addListener(keyListener);

Regards

Andy