# Stopping dynamic scroll using mouse coordinates

**URL:** https://forum.kirupa.com/t/stopping-dynamic-scroll-using-mouse-coordinates/241145
**Category:** flash
**Created:** [October 10, 2007, 2:05pm UTC](https://forum.kirupa.com/t/stopping-dynamic-scroll-using-mouse-coordinates/241145 "2007-10-10T14:05:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rollo23](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rollo23](https://forum.kirupa.com/u/rollo23)
#### Post date: [October 10, 2007, 2:05pm UTC](https://forum.kirupa.com/t/stopping-dynamic-scroll-using-mouse-coordinates/241145/1 "2007-10-10T14:05:37Z")

</div>

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](http://www.ptplondon.com/dynamictest)

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

```php

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:
