# Infinite menu stop on mouse out

**URL:** https://forum.kirupa.com/t/infinite-menu-stop-on-mouse-out/202222
**Category:** Uncategorized
**Created:** [September 28, 2006, 8:35pm UTC](https://forum.kirupa.com/t/infinite-menu-stop-on-mouse-out/202222 "2006-09-28T20:35:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![KrsFLy](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@KrsFLy](https://forum.kirupa.com/u/KrsFLy)
#### Post date: [September 28, 2006, 8:35pm UTC](https://forum.kirupa.com/t/infinite-menu-stop-on-mouse-out/202222/1 "2006-09-28T20:35:09Z")

</div>

Ok, I’m about to loose my mind, I hope there is someone out there who can give me some pointers.

So, i have an infinte menu (actionscript (AS2) posted bellow)

When the mouse moves out of the movieclip over or under, it stops. However if i drag the mouse to the right or left of it, it just keeps on speeding up.

Anyone got a clue?

onClipEvent (load) {  
var xcenter = 280, speed = .01, decel = .90, accel = 0;

}  
onClipEvent (enterFrame) {  
var distance = \_root.\_xmouse-xcenter;  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)) {  
accel += distance\*speed;  
}  
\_x += accel \*= decel;  
if (\_x\>0) {  
\_x = -2255;  
} else if (\_x\<-2255) {  
\_x = 0;  
}  
}
