# Number of "slides" in sliding menu?---

**URL:** <https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159>\
**Category:** Uncategorized\
**Created:** [July 28, 2004, 11:03pm UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159 "2004-07-28T23:03:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnyFlash](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@johnnyFlash](https://forum.kirupa.com/u/johnnyFlash)\
**Post date:** [July 28, 2004, 11:03pm UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/1 "2004-07-28T23:03:14Z")

</div>

I was just wondering about how i would change the number of “slides” in the sliding menu tutorial here on kirupa?  
[http://www.kirupa.com/developer/flash5/slidingmenu.htm](http://www.kirupa.com/developer/flash5/slidingmenu.htm)

So, instead of only 4, i want 6.

Much thanks in advance :thumb:

---

<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:** [July 28, 2004, 11:24pm UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/2 "2004-07-28T23:24:46Z")

</div>

after reading the tutorial, you should be abled to do that on your own

well,  
select the “clipgénéral” (“general”) movieclip and change the actionscript line  
\_root.xnew = \_root.mask2.\_x + (4-1)\*100/2 ;  
to  
\_root.xnew = \_root.mask2.\_x + (6-1)\*100/2 ;  
open the "clipgénéral"  
add one item on the right and the left side  
then open the “scroller” movieclip (the masked one)  
you will see 2 layers:  
one is called invisible buttons. click on that layer and four borders will appear over the miniature instance of the “clipgénéral”.  
click one of them, and copy it two times (“ctrl”+“c” -\> “ctrl”+“v”) and drag one of the copies over each of your additional slides.  
than change the actionscript of the left one to  
on (press) {  
\_root.xnew = \_root.mask2.\_x+(6-1)\*100/2;  
}

and of the right one to  
on (press) {  
\_root.xnew = \_root.mask2.\_x+(-6-1)\*100/2;  
}

---

<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:** [July 28, 2004, 11:37pm UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/3 "2004-07-28T23:37:45Z")

</div>

Thanks for helping out McGiver.  
And yea, i did read the entire tutorial…but i just did not understand any of the actionscript really…

And i tried out your method, but i can’t seem to get it to work correctly. I ended up making 7 slides instead of 6. So, i’m not sure if that’s the problem or not.  
Can you take a look at my .fla and see where i’m going wrong?

**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:** [July 28, 2004, 11:47pm UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/4 "2004-07-28T23:47:48Z")

</div>

yes, it makes a difference if its six or seven.

---

<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:** [July 28, 2004, 11:54pm UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/5 "2004-07-28T23:54:09Z")

</div>

**thanks so much, mcgiver**

If you could be so kind as to tell me what this line of code on the buttons is doing, more specifically the \_y+(6)\*, because on some of the buttons you have 2, then -2, and so on, that would be great–otherwise, thanks a lot for your time. 🙂

```auto

 on (press) {
 _root.ynew = _root.mask2._y+(6)*100/2;
 }
 

```

---

<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:** [July 29, 2004, 12:09am UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/6 "2004-07-29T00:09:44Z")

</div>

each of your sliders is 100 pixles heigh.

the position of the frame is \_root.mask2.\_y

the sliders are positioned from the middle of the parent movieclip to the left and the right (1234567 and 4 would be in the middle, if you have 6 sliders, the middle is between 3 and 4)  
so if you want the slider 4 of 7 (the one in the middle) to show in the frame the new position of the sliders mc must be equal to the position of the frame.  
if you want slider 7 to show, the position must be 300pixels left of the frame (the width of 3 sliders)

so  
on (press) { }  
runs the code inside the {} if someone clicks that button

\_root.ynew = \_root.mask2.\_y+(6)\*100/2;  
declares a variable called “ynew” which is placed in the main timeline (\_root) and gives it the value of the position of the frame plus 3 times the width of the scrollers.

the variable \_root.ynew is later read by move() function which moves the slider.

\_root.ynew = \_root.mask2.\_y+(3)\*100;  
would do it too, but the author of the tutorial thought it might be better to use  
\_root.ynew = \_root.mask2.\_y+(4-1)\*100/2;  
if there is an even number of sliders

---

<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:** [July 29, 2004, 12:22am UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/7 "2004-07-29T00:22:14Z")

</div>

Alright, i’m starting to understand this a little better now.

One last question…when you mentioned the height of all the mc’s being 100, which is reflected in this part of the code:  
\*100/2

What if one of my mc’s would be, say, 250, but still, the rest of the mc’s are 100. Would i change the code for the button for that specific mc to:  
\*250/2

Or, is it necessary for the 100 to be a consistent number for all of the mc’s.  
^that’s my guess. But i was just curious.

Thanks for all of your time. 🙂

---

<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:** [July 29, 2004, 12:48am UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/8 "2004-07-29T00:48:45Z")

</div>

nope  
…+(4-1)\*100/2 means the movieclip gets moved 150 pixel so that the movieclip you want to be in the middle.  
if only one mc was 250 (doesn’t make any sense at all since the border wouldn’t show the whole slider) and it was the second one left from the middle  
…+(4-1)\*250/2 would move the “clipgénéral” by 375 pixels while the middle of your slider nr 4 is only 225 from the middle (one mc with 100 px width and half of the mc with 250 width)

i.e.  
you have 9 mcs, nr5 is in the middle 123456789

and you want nr 8 to display  
nr 5’s height is 50  
nr 6’s height is 100  
nr 7’s height is 180  
nr 8’s height is 200

than you should move the whole clipgénéral for 405 px left (50/2+100+180+200/2)

---

<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:** [July 29, 2004, 12:59am UTC](https://forum.kirupa.com/t/number-of-slides-in-sliding-menu/59159/9 "2004-07-29T00:59:17Z")

</div>

Ok.

I’ll work on it a little more, and if i get confused, i’ll just post again.

Thanks for your help Mcgiver, your’e a true life-saver :thumb:
