# Infinite menu tutorial

**URL:** https://forum.kirupa.com/t/infinite-menu-tutorial/27717
**Category:** Uncategorized
**Created:** [August 5, 2003, 10:07pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717 "2003-08-05T22:07:35Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![sci](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@sci](https://forum.kirupa.com/u/sci)
#### Post date: [August 5, 2003, 10:07pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/1 "2003-08-05T22:07:35Z")

</div>

Hello all. This is my first post… I hope somebody can help.

I completed the “infinite menu” tutorial from the MX special effects section and I’m trying to put it to practical use as a menu for a college project. The problem I’ve got and which I’m really struggling with is how to stop the scroll bar moving once a user has moved the mouse away from the actual menu. It doesn’t look too great when the user goes to another area of the page that the menu is still whizzing all over the place.  
Is their a way of designating an ‘active’ area around the menu that reacts to the users mouse movements and then making the scrolling stop once the user has moved away?

I hope I have explained this clearly and I hope somebody can help.

many thanks

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 5, 2003, 10:38pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/2 "2003-08-05T22:38:30Z")

</div>

You would have to use a hitTest on that area to see if the mouse is there and then just toggle the speed variable from there - unless you want it to ease to a stop, then it would be a bit different.

I think it would be rather simple - post your fla as it is and I’ll see what I can do. It’s kind of hard to explain what I’m thinking.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 5, 2003, 11:16pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/3 "2003-08-05T23:16:47Z")

</div>

I’m sorry, Freddy. I couldn’t help it. 😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 5, 2003, 11:22pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/4 "2003-08-05T23:22:42Z")

</div>

Aww, see?? Kax beats me again!! 😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 6, 2003, 7:29pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/5 "2003-08-06T19:29:05Z")

</div>

thanks for the help. I cannot download your fla. file though for some reason. My browser isn’t having any of it.

Could you just post the script?

thanks

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 6, 2003, 7:37pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/6 "2003-08-06T19:37:26Z")

</div>

[AS]onClipEvent (load) {  
var xcenter = 150, 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 = -300;  
} else if (\_x\<-300) {  
\_x = 0;  
}  
}[/AS]  
Keep in mind that I just took the FLA from the tutorial and modified the code, you’ll have to change some values to suit your needs.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 6, 2003, 8:07pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/7 "2003-08-06T20:07:57Z")

</div>

that’s great. I’ll give it a go.

thanks again for all your help.

much appreciated  
=)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 6, 2003, 8:09pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/8 "2003-08-06T20:09:31Z")

</div>

No problem, sci. =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [August 7, 2003, 10:13pm UTC](https://forum.kirupa.com/t/infinite-menu-tutorial/27717/9 "2003-08-07T22:13:04Z")

</div>

hello Kax

I’ve tried this modified code:

onClipEvent (load) {  
ycenter = 62;  
speed = .01;  
decel = .90;  
accel = 0;  
}  
onClipEvent (enterFrame) {  
var distance = \_root.\_ymouse-ycenter;  
accel += this.hitTest(\_root.\_ymouse, \_root.\_xmouse, true) ? distance\*speed : 0;  
accel \*= decel;  
\_y += accel;  
if (\_y\>0) {  
\_y = -69.5;  
}  
if (\_y\<-69.5) {  
\_y = 0;  
}  
}

but it still doesn’t seem to be working correctly as it is hardly moving. Any ideas what I’m doing wrong? I’ve placed this script on a menu sitting on the top left hand corner of my home page which is made of 4 text buttons (menu\_01, menu\_02 etc) created in the standard way.

Any ideas would be great.

ps. I’ve tried several times to attach the swf to this post for you to have a look at but I keep getting an error message saying it doesn’t recognise the file format

sci.
