{f}MX- mouse actions

Hoy hoy
I have a scroll going that I need to stop when the mouse has left the window that the MC is playing in. can someone help out or point me in the right direction?

here is what I have:

onClipEvent (load)
{
xcenter=500;
speed=1/30;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x-=(distance*speed);
if (_x > 0) _x=1;
if (_x < -560) _x=-560;
}

I need it to work with this function.

Thanks in advance
Kip