Brush size change and undo for paint app

Hey guys im currently developing a flash paint app for the psp and im stuck in a little rut here i need a way to allow the user to change brush size depending on what they press aka if they press pencil get a thin line stroke, if big brush big line stroke is there anyway of doing this?

and the next one how can i make a undo button so it undos the last line done

here my code so far

//starting color is black
var colorChoise=0x000000;
_root.createEmptyMovieClip("line", 1);
_root.onMouseDown = function() {
    line.moveTo(_xmouse, _ymouse);
    line.lineStyle(2, colorChoise, 100);
    this.onMouseMove = function() {
        line.lineTo(_xmouse, _ymouse);
        updateAfterEvent();
    };
};
_root.onMouseUp = function() {
    this.onMouseMove = null;
};
buttonErase.onPress = function() {
    _root.line.clear();
};
red.onRelease = function() {
    colorChoise = 0xFF0000;
};
green.onRelease = function() {
    colorChoise = 0x00CC00;
};
blue.onRelease = function () {
    colorChoise = 0x0033FF;
};
yellow.onRelease= function () {
    colorChoise = 0xFFFF00;
};
purple.onRelease = function () {
    colorChoise = 0xFF00FF;
};
pink.onRelease = function () {
    colorChoise = 0x9933FF;
};
samon.onRelease = function () {
    colorChoise = 0xFF99CC;
};
black.onRelease = function () {
    colorChoise = 0x000000;
};
lgreen.onRelease = function () {
    colorChoise = 0x99FF99;
};
grey.onRelease = function () {
    colorChoise = 0xD0D0D0;
};
lblue.onRelease = function () {
    colorChoise = 0xCCFFFF;
};
orange.onRelease = function () {
    colorChoise = 0xFF6600;
};

thanks a lot for your help
fireblade

hey sorry a bit offtopic
oh can i lock the drawing area so there not drawing all over the swf document just on made canvas? i know its gunna be simple but mind aint working right lol

You will have to tweak… hitTest for the restricted area… or you can startDrag a dummy dot and ristrict the stratDrag area in the function itself and drawing only the positions of that dot