Drop Down Menu

Now, before anyone suggest the senocular tutorial on button capturing, I’ve already seen it, and it was very helpful. However, it did not deal with onRollOver events. I want my menu to drop down when someone rolls their mouse over it and disappear when their mouse leaves the movieclip. I replaced the onPressHandler in the tutorial with onRollOver, but the delegation didn’t seem to work. I’ve also tried the same thing with a hitTest function within a mouse listener called myEvent, yet it doesn’t work either.

The first solution with the onRollOver event looked like this…


//onRollOver and onRollOut commands.
site_mc.onRollOver = function()
{
    site_mc.gotoAndStop(2);
}
site_mc.onRollOut = function()
{
    site_mc.gotoAndStop(1);
}


// delegate to all children
site_mc.home_mc.onPress = function(){
    site_mc.onRollOver();
    trace("home");
}
site_mc.forum_mc.onPress = function()
{
    site_mc.onRollOver();
    trace("forum");
}
site_mc.tactica_mc.onPress = function()
{
    site_mc.onRollOver();
    trace("tactica");
}
site_mc.photos_mc.onPress = function()
{
    site_mc.onRollOver();
    trace("photos");
}

The hitTest solution looks like this…


//adds a mouse listener called myEvent
var myEvent = new Object();
Mouse.addListener(myEvent);

//hitTest command, executed through myEvent. This command makes site_mc go to frame 2, if the cursor is over site_mc
myEvent.onMouseMove = function()
{
    if(site_mc.hitTest(_xmouse,_ymouse,true) == true)
    {
        site_mc.gotoAndStop(2);
    }
        if(site_mc.hitTest(_xmouse,_ymouse,true) == false)
    {
        site_mc.gotoAndStop(1);
    }
}

// parent instance
site_mc.onPressHandler = function()
{
    trace("site bar");
}


// delegate to all children
site_mc.home_mc.onPress = function()
{
    site_mc.onPressHandler();
    trace("home");
}
site_mc.forum_mc.onPress = function()
{
    site_mc.onPressHandler();
    trace("forum");
}
site_mc.tactica_mc.onPress = function()
{
    site_mc.onPressHandler();
    trace("tactica");
}
site_mc.photos_mc.onPress = function()
{
    site_mc.onPressHandler();
    trace("photos");
}

The delegation works if the onRollOver and hitTest parts of the code weren’t there, but I can’t manage to get the menu to actually drop down, without having the buttons not working…