# Limiting the scrolling of the Infinite Menu \[renamed\]

**URL:** <https://forum.kirupa.com/t/limiting-the-scrolling-of-the-infinite-menu-renamed/70588>\
**Category:** flash\
**Created:** [November 15, 2004, 4:21pm UTC](https://forum.kirupa.com/t/limiting-the-scrolling-of-the-infinite-menu-renamed/70588 "2004-11-15T16:21:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sloopie](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@sloopie](https://forum.kirupa.com/u/sloopie)\
**Post date:** [November 15, 2004, 4:21pm UTC](https://forum.kirupa.com/t/limiting-the-scrolling-of-the-infinite-menu-renamed/70588/1 "2004-11-15T16:21:04Z")

</div>

I’d like to limit the scrolling of the Infinite Menu to an area NEAR the menu and not when the cursor is anywhere on the stage.

See the original tutorial for the Infinite Menu:

> **[kirupa.com - Create the Infinite Menu](https://www.kirupa.com/developer/mx/infinite.htm)**
>
> Learn how to create the coolest navigation effect, the infinite menu.

I’m assuming that, to do this, I would need to use an if/else script with the condition being a rectangle of coordinates on the stage and a result of a scrolling menu when the cursor is within those coordinates.

I found this code on another thread for a similar menu idea but can’t figure it out how to fit the Infinite Menu script into it (see [http://www.kirupaforum.com/forums/showthread.php?t=61563&highlight=mouse+coordinates](http://www.kirupaforum.com/forums/showthread.php?t=61563&highlight=mouse+coordinates) for entire thread):

> 

onClipEvent(load){  
this.\_x=0; //set original x  
this.\_y=0; //set original y  
divider=5; //speed  
numx=this.\_x; //numx is destination x  
numy=this.\_y; //numy is destination y  
}

onClipEvent(enterFrame){  
if(\_xmouse\>300) {  
numx=-1; //set destination x  
}  
else{  
numx=9; //set destination x  
}  
x=numx-\_x; //setup variable named x  
this.\_x+=x/divider; //see the x transition  
//y=numy-\_y; //setup variable named y  
//this.\_y+=y/divider; //see the y transition  
}  
onClipEvent (load) {  
\_y = 0;  
speed = 5;  
}  
onClipEvent (enterFrame) {  
endY = \_root.\_ymouse;  
\_y += (endY-\_y)/speed;  
}

And here’s the Infinite Menu code I’d like to use as the result of the coordinates coding:

> 

onClipEvent (load) {  
ycenter = 375;  
speed = 10/100;  
}  
onClipEvent (enterFrame) {  
var distance = \_root.\_ymouse-ycenter;  
\_y += -(distance\*speed);  
if (\_y\>0) {  
\_y = -596;  
}  
if (\_y\<-596) {  
\_y = 0;  
}  
}

Thanks for any help!!
