How to erase using actionscript?

Hi,

I’ve just started working on a Flash-based annotation tool. How it works is I place a transparent flash movie in a DIV over a HTML page and draw on it.

Now the drawing part turned out to be fairly simple and I found numerous examples to get me free-form drawing. Its the erasing that’s driving me nuts. All the examples out there I looked at either cleared the entire canvas, or let me click on specific drawings to take them off the canvas. I need an MS-Paint style eraser that just rubs things in its path.

I could draw in white to simulate erasing, but that wont work. I have a transparent flash movie and the background HTML needs to show through.

Here’s the script for the drawing bit I picked up from Adobe, and on which I’m trying to build the eraser. I’m open to a different way of drawing, if it’ll help.

init();
stop();
function init() {
	initDrawing();
	initMouse();
}
function initDrawing() {
	createEmptyMovieClip("draw_mc", 10);
	draw_mc.lineStyle(2, 0x000000);
	createEmptyMovieClip("temp_mc", 20);
}
function initMouse() {
	mouseMoveListener = new Object();
	mouseMoveListener.onMouseMove = function() {
		mouseMoveEvent();
	};
	mouseClickListener = new Object();
	mouseClickListener.onMouseDown = function() {
		mouseDownEvent();
	};
	mouseClickListener.onMouseUp = function() {
		mouseUpEvent();
	};
	Mouse.addListener(mouseClickListener);
}
function mouseDownEvent() {
	draw_mc.moveTo(_xmouse, _ymouse);
	Mouse.addListener(mouseMoveListener);
}
function mouseUpEvent() {
	temp_mc.clear();
	Mouse.removeListener(mouseMoveListener);
}
function mouseMoveEvent() {
	// Remove any previous drawing
	temp_mc.clear();
	// Draw dot at End Point
	temp_mc.lineStyle(6, 0x00ff00);
	temp_mc.moveTo(_xmouse, _ymouse);
	temp_mc.lineTo(_xmouse + 0.5, _ymouse);
	draw_mc.lineTo(_xmouse, _ymouse);
}