Stopping dynamic scroll using mouse coordinates

Hi,
i’m brand new to this forum and I hope someone can help me with this ‘simple’ but yet complicated code. It’s doing my head in I swear. I’ve been doing flash for some time, and I have quite a reasonable understanding of Actionscript, but this one goes beyond me.

Basically I have this horizontal scrolling mousecontrol script (yea I know its getting old, hehe), and i am trying to stop the scrolling when the mouse leaves the area using _ymouse and _xmouse coordinates. I can make it work when the mouse leaves the upper edge but I need to make it work when it leaves the bottom, left and right as well. Testpage is here: http://www.ptplondon.com/dynamictest

If anyone can help that would be cool, cause I know this will come in handy later.


onClipEvent (load)
{
   xcenter=520;
   speed = 1/40;
}

onClipEvent (enterFrame)
{
    if (_ymouse>-200) {
   var distance=_root._xmouse-xcenter;
   _x -= (distance*speed);
   if (_x > 0) _x=-3272;
   if (_x < -3272) _x=0; 
   _root.arrow1.gotoAndStop(1);
   } else if (_ymouse<-200) {
       _root.arrow1.play()
    delete this.onEnterFrame;
    
}
}

Thanks!:cool: