Object Follow cursor rotation problem, Actionscript 2 coding Flash

Hi

Can anyone help me sort out a flip problem with an mc clip that follows the mouse and rotates towards the movement but flips awkwardly when you move the mouse again.
here is the code I found

//Place this on the mc

onClipEvent (load) {
//_x = 0;
//_y = 0;
speed = 6;
area = 0;
}
onClipEvent (enterFrame) {

//attach mc to the pointer if mouse over the area
if (area == 0) {
this.play();
endX = _root._xmouse;
endY = _root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;

//rotate MC to follow the mouse angle
this.onMouseMove = function() {
_rotation = (Math.atan2(_root._ymouse-_y, _root._xmouse-_x))*(180/Math.PI);
ease = 3;
};
}
}

I’m a bit of a novice so please be gentle. Thanks in advance