Slider menu

Hello all

I was wondering if anyone could help with this.
I am trying to create the slider and want the slider to stop sliding once the mouse rolls off the area of the movie.
I have this for the code right now, it doesn’t stop when u move ur mouse from the slider.

onClipEvent (load) {
xcenter = 510;
speed = 1/50;
}
onClipEvent (enterFrame) {
var distance = _root._xmouse-xcenter;
_x += -(distance*speed);
if (_x>324) {
_x = 324;
}
if (_x<-576) {
_x = -576;
}
}

can anyone help me with this?

thanks,
moman