Menu with Slider
       by Bryan Arciniega : August 10, 2004

In the previous page you created the actual menu, but I did not explain why the menu and slider work. I'll do that on this page plus provide you with the source files.

Code Explanation
You'll notice that a lot of the code has to do with moving your object along the x.

MovieClip Actions

  • slider_mc.onEnterFrame = function() {
    This performs a function on the slider_mc onEnterFrame. onEnterFrame is an action triggered continuously at the frame rate of the movie.
  • this._x += (xMove1-this._x)/easeSpeed;
    This is the function which moves the slider_mc along the x axis.
    button_1.press = function() {
    This performs a task (function) on button_1.
  • xMove = button_1._x;
    This is the task in relation to the above line which is performed. The slider_mc will slide to the center of button_1.

Button Actions

  • on (rollOver) {
    Self explanatory, when the user moves his mouse over the button.
  • slider.xMove = button_1._x;
    "slider" is the Instance Name of the slider_mc. When the button is rolled over, the "slider" will move along the x (horizontally) according to where you placed it on the stage.

Slider Movie Clip

  • onClipEvent (load) {
    When this appears in the Timeline, execute action: load.
  • xMove = _x;
    Move along the x axis or horizontally.
  • easeSpeed = 5;
    This is where you can control the speed at which the "slider" moves. The lower the number the faster it moves. The higher the number, well you get the idea.

Incase you're having problems, or you just chose not to do it yourself, I've provided the Source File for you to look at:

Download ZIP

And of course, if you have any questions, complaints, or arguments, do not be afraid to post them in the kirupaForum. I promise we won't bite.

Your friendly Forum wizard,

Bryan Arciniega aka wizard

 


page 2 of 2

 

 




SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple.