Urgent Drawing API help Please

Hi guys,

I need some help with modifying the behaviour of the drawing API in flash (See below). Basically, I need to know how I can make it so that only straight lines can be drawn at right angles. If anybody can help, would be much appreciated.



this.createEmptyMovieClip("canvas_mc", 999);
var isDrawing:Boolean = false;
//
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
    canvas_mc.lineStyle(5, 0x000000, 100);
    canvas_mc.moveTo(_xmouse, _ymouse);
    isDrawing = true;
};
mouseListener.onMouseMove = function() {
    if (isDrawing) {
        canvas_mc.lineTo(_xmouse, _ymouse);
        updateAfterEvent();
    }
};
mouseListener.onMouseUp = function() {
    isDrawing = false;
};
Mouse.addListener(mouseListener);


Many Thanks

TAJ