Restraining drawing api to a certain area

I’m trying to create a drawing application in flash CS4, but I need the viewers to draw in a certain area only, and I want the cursor to change into a brush when I am hovering over that certain area.
I tried adding an if statement to check if the cursor is in that certain area, but now it doesn’t draw at all. Please help.

stop();

var drawIt:Boolean = false;
var startX:Number;
var startY:Number;

var strokeWidth = 3;
var strokeColor = 0x000000

var canvas:MovieClip = new MovieClip();
addChild(canvas);
var myLine:Graphics = canvas.graphics;
myLine.lineStyle(strokeWidth, strokeColor, 1);

stage.addEventListener(MouseEvent.MOUSE_DOWN, startDraw);
stage.addEventListener(MouseEvent.MOUSE_UP, stopDraw);
stage.addEventListener(Event.ENTER_FRAME, drawLine);

function startDraw(e:MouseEvent){
[COLOR=“Red”]if (( x > 500 && x < 900) && (y > 200 && y < 450))[/COLOR]
{drawIt = true;

startX = mouseX;
startY = mouseY;
myLine.moveTo(startX, startY);}

}

function stopDraw(e:MouseEvent){
drawIt = false;
}

function drawLine(e:Event){
if (drawIt) {
var newX = mouseX;
var newY = mouseY;
// see if location has changed
if ((newX != startX) || (newY != startY)) {
// draw line to new location
myLine.lineTo(newX, newY);
// reset location for new time
startX = newX;
startY = newY;
}
}
}