# Sliding/Infinite Menu

**URL:** https://forum.kirupa.com/t/sliding-infinite-menu/8054
**Category:** flash
**Created:** [November 13, 2002, 2:28am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054 "2002-11-13T02:28:59Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![kruza](https://avatars.discourse-cdn.com/v4/letter/k/a9a28c/32.png) [@kruza](https://forum.kirupa.com/u/kruza)
#### Post date: [November 13, 2002, 2:28am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/1 "2002-11-13T02:28:59Z")

</div>

onClipEvent (load)  
{  
xcenter=377;  
speed=1/10;  
}  
onClipEvent (enterFrame)  
{  
var distance=\_root.\_xmouse-xcenter;  
\_x+=(distance\*speed);  
if (\_x \> 0) \_x=-754;  
if (\_x \< -754) \_x=0;

}

Ok i did the tutorial but something is wrong cuz when i created my own little sliding thingy and i put my mouse so it slides left or right on the right side it cuts off a bit when going infinite.

I think its something to do with the positioning of my menu because its not on x=0 its on x=120.8 and i was trying to work out how to fix it but i’m stuck…and when i move the menu to x=0 it works nicely…please helP! what values do i need to change?

---

<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: [November 13, 2002, 5:35am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/2 "2002-11-13T05:35:41Z")

</div>

Post your .fla so somebody can give better help.

---

<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: [November 13, 2002, 1:01pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/3 "2002-11-13T13:01:37Z")

</div>

well its actually a tutorial from this site with a few changes…just length and positioning…

PLZ HELP!

---

<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: [November 13, 2002, 11:27pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/4 "2002-11-13T23:27:21Z")

</div>

> Post your .fla so somebody can give better help.

---

<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: [November 14, 2002, 7:38am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/5 "2002-11-14T07:38:26Z")

</div>

might be a localToGlobal issue… though I’ve never gotten that to work correctly so… I guess I really don’t have an answer. 🙂

---

<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: [November 14, 2002, 8:38am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/6 "2002-11-14T08:38:19Z")

</div>

sorry guys i’ll post the .fla now

---

<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: [November 14, 2002, 8:40am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/7 "2002-11-14T08:40:07Z")

</div>

could someone also correct the center for me…

thanks for all your helP!

---

<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: [November 14, 2002, 1:34pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/8 "2002-11-14T13:34:57Z")

</div>

Fixed it! The numbers were all a bit wrong…  
hehe took me about 2min 🙂  
**NB! Change the line  
var distance = \_root.\_xmouse-xcenter;  
to  
var distance = (\_root.\_xmouse-xcenter)**-1\*;  
so If you move the cursor to the left the menu moves to the right… more comfortable. If I see “pictures” on the left that I move my cursor to the left to click on it but if you don’t add “\*-1” then the button “pictures” moves away from the cursor and that’s annnoying…\*\*

---

<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: [November 14, 2002, 3:19pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/9 "2002-11-14T15:19:07Z")

</div>

ok thanks…but what numbers do i have to change?

because it still seems to cut off on the right of the slide JUST after the number 6 appears…

---

<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: [November 14, 2002, 4:21pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/10 "2002-11-14T16:21:54Z")

</div>

OOPS! Stupid me! How didn’t I notice!  
I forgot to attach the .fla and din’t notice it! 😛 silly me 🙂 ![](http://www.kirupa.com/forums/smileys_files/bangin.gif)  
there ya go 🙂

---

<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: [November 15, 2002, 3:04am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/11 "2002-11-15T03:04:21Z")

</div>

thanks alot!

WORKS GREAT!!!

…ok i wanted one more thing to be added…

i would love to know how to make it pause slightly after the mouse isn’t over the strip…like on the sony website…where it moves the mouse goes over then it goes somewhere else and the strip is paused and then slowly starts moving again…  
do you know what i mean?

---

<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: [November 15, 2002, 3:43am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/12 "2002-11-15T03:43:11Z")

</div>

oh & another question…how do i make the movement of the strip subject only when the mouse is over the strip…not around 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: [November 15, 2002, 5:48am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/13 "2002-11-15T05:48:51Z")

</div>

where on the sony site… I went [sony.com](http://sony.com) and didnt see anything - their site is so big I didnt really feel like searhing.

Peace

---

<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: [November 15, 2002, 2:14pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/14 "2002-11-15T14:14:04Z")

</div>

I thin what you mean by that 1. question but… maybe explain a bit more…  
that second one doesn’t look hard though!  
you can detect where the mouse is before moving the slider

if((\_root.\_xmouse\>=100) and (\_root.\_xmouse\<=300) and(\_root.\_ymouse\>=200) and (\_root.\_ymouse\<=400)) {  
the actions here  
}

or something like that! OR you can use hitTest which is easier!  
[http://www.kirupa.com/developer/actionscript/hittest.asp](http://www.kirupa.com/developer/actionscript/hittest.asp)  
🙂

---

<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: [November 15, 2002, 2:17pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/15 "2002-11-15T14:17:16Z")

</div>

I just remembered! If you use hitTest then you have to make a movieclip follow the mouse cursor and detect the movieclips position!

---

<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: [November 17, 2002, 2:55pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/16 "2002-11-17T14:55:58Z")

</div>

THis is the SONY Link [http://www.sonypictures.com/movies/index\_ie.html](http://www.sonypictures.com/movies/index_ie.html)

Ok now here’s what i want to do.  
-Firstly i want constant movement to the left or whatver…then when the mouse goes over it moves to relative position (that parts done)  
-And THEN i would like it if your cursor goes off the moving menu it pauses slightly then starts rolling again just like in the SONY site. BUT i don’t want arrows…

TA!

---

<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: [November 17, 2002, 3:39pm UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/17 "2002-11-17T15:39:20Z")

</div>

now you should know how to detect if the cursor is not on the menu.  
and this should work…

if not on menu… {  
nohittimer = getTimer()/1000  
if(getTimer()/1000-nohittimer \>= 2) {  
\_root.menumove = true;  
}

this detects if 2 seconds have elapsed since the cursor moved out of the menu area. the next should be put on a movieclip

onClipEvent(enterFrame) {  
if(\_root.menumove) {  
mymenu.\_x += 2;  
}  
}

This makes the menu move.  
and you also have to make \_root.menumove false when you move the cursor on the menu…

---

<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: [November 20, 2002, 10:20am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/18 "2002-11-20T10:20:28Z")

</div>

thanks alot SYKO!

i worked out how to make the menu not move when i’m not around it…

BUT i can’t make it move by itself …maybe its because i put all your code into my movieclip of the menu???

where do i put the timer code etc?

---

<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: [November 26, 2002, 2:21am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/19 "2002-11-26T02:21:22Z")

</div>

i found out how to make the menu move by itself BUT the 2 sec “pause” isn’t working…

EDIT\* also when the menu is moving by itself does not repeat…just passes once…i’m trying to work that out now \*EDIT

---

<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: [November 27, 2002, 12:40am UTC](https://forum.kirupa.com/t/sliding-infinite-menu/8054/20 "2002-11-27T00:40:43Z")

</div>

I really need some good old help here…

All i need to work now is that when the Sliding Menu moves by itself it should repeat and appear infinite, because at the moment it passes once…i can’t seem to get it to repeat! aaaaarrgghh…  
please read the above points for your reference…

[Next page](https://forum.kirupa.com/t/sliding-infinite-menu/8054.md?page=2)
