I have a drop down menu that I’m having a big issue with. Here’s how it should work:
I have a row of menu buttons. when I click on a button a panel drops down. When I click on the panel the panel stays. When I navigate away from the panel the panel stays. Only when I click off the panel does it disappear but never when I’m on it.
So my approach has been to set a variable whenever I click on a menu to record the current mc. Then, compare that to what’s under the cursor whenever I click.
//All buttons listener from Array;
for (var k:int=0; k<allArray.length; k++)
{
main_mc[allArray[k]].addEventListener(MouseEvent.MOUSE_DOWN, nmMouseDown);
}
function nmMouseDown(e:MouseEvent):void
{
var buttonName:MovieClip = e.currentTarget as MovieClip;
curMC = buttonName.name;
main_mc[buttonName.name].gotoAndStop(2);
}
//Stage listener
stage.addEventListener(MouseEvent.MOUSE_DOWN,globalMouseDown);
function globalMouseDown(e:Event):void
{
if (main_mc[curMC].hitTestPoint(mouseX,mouseY,true))
{
//Nothing
}
else
{
rewindNav();
}
}
function rewindNav():void
{
for (var m:int=0; m<allArray.length; m++)
{
main_mc[allArray[m]].gotoAndStop(1);
}
}
Any help is greatly appreciated!p
-SP