Please help me complete this code

Hello,
With the help of some nice people I now have a Flash paint program.

http://www.kirupa.com/forum/showthread.php?t=279206

My next step is to incorporate this program into another little Flash movie.
I pasted the following code in the first frame of a movie clip.
This movie clip is my ‘canvas’,
i.e. the borders that the paint application must stay within.
What can I add to this code to give it the movie clip’s dimensions of 500 x 375 pixels?
Also, I want to add some sort of button that clears the paint.

Thanks,
Nicole

import flash.display.Sprite;
import flash.events.MouseEvent;

var brush:Sprite = new Sprite();
addChild (brush);

initCanvas ();

function initCanvas ():void
{
    stage.addEventListener (MouseEvent.MOUSE_DOWN, startPainting);
    stage.addEventListener (MouseEvent.MOUSE_UP, stopPainting);
}
function startPainting (me:MouseEvent):void
{
    brush.graphics.lineStyle (randRange(2, 5), Math.random() * 0xFFFFFF);
    brush.graphics.moveTo (stage.mouseX, stage.mouseY);
    stage.addEventListener (MouseEvent.MOUSE_MOVE, paint);
}

function paint (me:MouseEvent):void
{
    brush.graphics.lineTo (stage.mouseX, stage.mouseY);
}

function stopPainting (me:MouseEvent):void
{
    stage.removeEventListener (MouseEvent.MOUSE_MOVE, paint);
}

function randRange (min:Number, max:Number):Number
{
    return Math.random() * max - min + 1 + min;
}