Replacing cursor causes problems

Hi,
I’ve adapted Senocular’s paint programme from his tutorial, in which the user can draw on the screen with the mouse.

barebones Code:
//drawing board = an mc prepositioned on stage.

var canvas:Shape = new Shape();
canvas.x = drawingBoard.x;
canvas.y = drawingBoard.y;
addChild(canvas);
function startDrawing(event:MouseEvent):void {
canvas.graphics.lineStyle(5, 0x000000);
canvas.graphics.moveTo(canvas.mouseX, canvas.mouseY);
drawingBoard.addEventListener(MouseEvent.MOUSE_MOVE, whileDrawing);
}

function whileDrawing(event:MouseEvent):void {
canvas.graphics.lineTo(canvas.mouseX, canvas.mouseY);
}

function stopDrawing(event:MouseEvent):void {
drawingBoard.removeEventListener(MouseEvent.MOUSE_MOVE, whileDrawing);
}

drawingBoard.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
drawingBoard.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
drawingBoard.addEventListener(MouseEvent.ROLL_OUT, stopDrawing);

This works fine. But when I replace the cursor I run into trouble:

code:
var spray_mc:spray=new spray();
spray_mc.x = 300
spray_mc.y = 300
addChild(spray_mc);

spray_mc.addEventListener(MouseEvent.CLICK, ragClick);
spray_mc.buttonMode = true;
function ragClick(event:MouseEvent):void{
addEventListener(Event.ENTER_FRAME,onragframe);
function onragframe (event:Event):void{

spray_mc.x = mouseX;
spray_mc.y = mouseY;
Mouse.hide();
}
event.updateAfterEvent();

}

The drawing becomes intermittent and patchy.
I think it’s something to do with layers: when I put spray_mc into a frame with an instance name (rather than calling it dynamically), and put it’s layer behind “drawing board” the drawing function works, although, obviously, the replacement cursor can’t be seen!

Can anyone tell me what’s going on, and suggest a solution?

Thanks for looking …