AS2 Need help with script for checking mousedirection

hi,
I would like to know how to perform a chek on the direction of the movement of the mouse on stage like let us say considering the stage.height/2 as the center if the mouse moves up it should trace up and down if it moves down…
I did it by storing all the _ymouse coordinates in temp array and chking if temp*>temp[i-1]
but it doesn’t work satisfactorily … would appreciate some help… i am posting the script i made…i do admit i am very bad in calculations so correct me if i went wrong somewhere



[COLOR=DarkRed]var m = [2, 3, 4, 5];
var temp = [];
var mouselist:Object = new Object();

var centerStg = Stage.height/2;

mouselist.onMouseMove = function() {
    var dist = _ymouse-centerStg;
    _root.dist.text = Math.round(dist);
    temp.push(dist);
    for (k=0; k<temp.length; k++) {
        if (temp[k]>temp[k-1]) {
            trace("mouseMoveDown");
        } else {
            trace("mouseMoveUp");
        }
    }
};
Mouse.addListener(mouselist);
[/COLOR]