Home / Tutorials / Navigation / Flash Menu and Mouse Customization /

Flash Tutorials

Flash Menu and Mouse Customization - Page 2

Posted by : webzo on Mar 21, 2008

 

5.0/5

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" Movie Clip 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" Movie Clip.
    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 Movie Clip 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 Movie Clip, and draw a pointer like this one:

The position of the drawing needs to be like above. Drag this Movie Clip 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.

no comment

Add comment

Please login to post comments.