views:

574

answers:

1

I got a flash vertical menu which has auto scroll but it scrolls too fast and the only way to slow it down is to increase the height of the button. I would like to replace the code with a scrollpane so i can control the menu :

CODE:: ** CODE CHUNK I NEED TO REMOVE - THEN ADD THE ADDITIONAL SCROLLPANE CODE- i hope**

menu_mc_Europe.onEnterFrame = function() {
    if (_ymouse>10 && _ymouse<boundry_mc._height && _xmouse>0 && _xmouse<boundry_mc._width) {
     ratio = (menu_mc_Europe._height-boundry_mc._height)/(boundry_mc._height);
     if (_ymouse>boundry_mc._height/2) {
      destScroll = -(_ymouse)*ratio-menu_mc_Europe.bttn_mc._height*ratio;
     } else {
      destScroll = -(_ymouse)*ratio
     }
     menu_mc_Europe._y += Math.round((destScroll-menu_mc_Europe._y)/5);
     if (menu_mc_Europe._y<-(totalBttns*menu_mc_Europe.bttn_mc._height-boundry_mc._height)) {
      menu_mc_Europe._y = -(totalBttns*menu_mc_Europe.bttn_mc._height-boundry_mc._height);
     }
    } else {
     destScroll = 1;
     menu_mc_Europe._y += Math.round((destScroll-menu_mc_Europe._y)/5);
    }
};

**

END OF CHUNK

A: 

hard to read that code w/out line breaks - what does 'ratio' represent above? is it a variable you can set? if not, just a wild guess, but try changing the divisor (the 5) in the '_y)/5' sections above?

Hi - sorry about code - i tried changing all the numbers but they dont seem to affect it. it gets its speed from the height set for the button so the bigger the height of the button the slower it will run - mad really but arrgghh I'm just trying to replace that chunk of code for a scrollpane - should i edit my question for better visual of the code... :)
.. the speed .. I mean the up and down autoscroll speed - it gets from the height of the button
much better, it looks like the divisor (5) in the lines "menu_mc_Europe._y += Math.round((destScroll-menu_mc_Europe._y)/5);" sets the number of frames it takes to get to the destination. make sure you change it in both lines. try changing that 5 to a 10, or better yet, replace it with a variable that you set at the top of the script (along with 'totalBttns', etc).
Hi I really want to keep the code but want to replace the hover state with a scroll pane and nav through the menu that way - i tried the setting you mentioned but it affects the first and last in the list - doesnt show..... enough but slows down - but very ropey in how it behaves - it doesnt run smooth if you change the numbers for that co-ordinate.... :(
by 'scroll pane', do you mean a scrollpane flash component, or something hand-rolled (like the above solution)? you can easily link a scrollpane component to a movieclip, but have limited control over the appearance. scripting something in AS would look similar to the above code. unless I'm mistaken, there's no easy way to set up a scrolling, masked movieclip in flash without using a component or getting your hands dirty. sorry I couldn't be of more help.
hmmm - yes i thought so - i dont want to use the existing ui scroller component but that is fine - i will have to go to the drawing board and code me litte fingers off - thanks for all you help - cheers J :)