Vectorials
Flash Perfection
3D Lessons
Tutorialkit
Markup Tutorials
Learn PHP
network
adv banner
Flash & Swish  Home Flash & Swish Flash Tutorials Flash Menu and Mouse Customization
rss

Flash Menu and Mouse Customization

Author: Webzo Studio More by this author


We are going to start with the drop down menu.

Create a new movie clip and draw a rectangle and a text box. Write "Menu".

image 1

Create another MC and draw a rectangle and a text box. Write "Home".

This one is going to be an item in our drop down menu.

image 2

Make 2 more item MC's, "Contact" and "About". Don't forget to make them in the same height and width.

Now make a new MC and export it for ActionScript with the identifier "DropDown".

Right click the second frame of this MC and select "Insert Blank Keyframe". Insert a third and a forth blank frame as well.

image 3

In the second frame add the "About" MC, in the third add the "Contact" MC then the "About" MC and in the forth frame add all item MC's.

Frame 2:

image 4

Frame 3:

image 5

Frame 4:

image 6

In the last frame open the actions window and add this:

stop();

This is a simple animation to scroll the items on our menu, and when it gets to the last frame we stop the animation.

Get back to the main timeline and drag the "Menu" MC to the stage, right click it and select "Actions".

Add this code:

onClipEvent(load)
{
      //First we create a variable to know whether our menu is open or not.
      var menuOpen = false;
}
onClipEvent(mouseDown)
{
      //when we use the mouse we check if the mouse is over the "Menu" MC.
      if (this.hitTest(_root._xmouse, _root._ymouse, true))
      {
            //if the menu was open, we remove the drop down and set menuOpen to false
            if (menuOpen)
            {
                  _root.DropDown.removeMovieClip();
                  menuOpen = false;
            }
                  //if the menu was closed we attach the drop down MC and set menuOpen to true.
                  else
                  {
                        _root.attachMovie("DropDown", "DropDown", 10);
                        _root.DropDown._x = 100;
                        _root.DropDown._y = 100;
                        menuOpen = true;
                  }
            }
      }

We finished the menu, so let's change the mouse pointer.

Create a new MC, and draw a pointer like this one:

image 7

The position of the drawing needs to be like above.

Drag this MC to the stage and give it an instance name of "pointer".

Open the action window of the main timeline and add this code:

//first we hide the default mouse pointer.
Mouse.hide();
//then we swap the depths of the pointer, so it doesn't get overlapped by the drop down.
_root.pointer.swapDepths(20);
this.onEnterFrame = function()
{
     //here we set the position of our pointer to the position of the mouse.
     pointer._x = _xmouse;
     pointer._y = _ymouse;
}

That's all, we just made a drop down menu and a new mouse in Flash.



About the Author:

Webzo Studio is a web design company located in the United States. Webzo Studio was founded in August 2005. We are a small team of designers that just love our job. The love of doing what we do is what makes us not doing our job as a job, but as an enjoyment.
read more about this author


Author's URL: www.webzo.org

Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Flash Menu and Mouse Customization"