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

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

So, instead of only 4, i want 6.

Much thanks in advance :thumb:

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;
}

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 :slight_smile:

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

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. :slight_smile:


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

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

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. :slight_smile:

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)

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: