Skip to main content
Inspiring
February 8, 2008
Answered

Drop Down Menu Actionscript

  • February 8, 2008
  • 18 replies
  • 1127 views
I have successfully created 4 drop down menus, however, I was wondering if there is a way to use a conditional or boolean statement to make it so only one drop down menu can be seen at a time.
For example
if (information.mc._visible = true) {
} else {(portfolio.mc._visible = false);
} else {(services.mc._visible = false);
} else {(toolbox.mc._visible = false);
}

Would something like that be possible so that you could only view one drop down menu at a time?
Any help would be appreciated. Thanks.
This topic has been closed for replies.
Correct answer eranicfetzer
If anyone wants to accomplish a similar task please go to www.actionscript.org and check out their Flash tutorials.

18 replies

eranicfetzerAuthorCorrect answer
Inspiring
March 13, 2008
If anyone wants to accomplish a similar task please go to www.actionscript.org and check out their Flash tutorials.
Inspiring
March 13, 2008
If anyone wants to accomplish a similar task please go to www.actionscript.org and check out their Flash tutorials.
Inspiring
March 6, 2008
I have tried making the paths header_mc.portofoliobtn and it seems like the functions do not work, can you have actionscript apply solely to a movieclip?
Inspiring
March 4, 2008
I used a tutorial and learned of the following actionscript:

portfoliobtn.onRollOver=function(){
if(menuOpen=="portfolio"){
null;
}
else if(menuOpen=="close" || menuOpen=="services" || menuOpen=="information" || menuOpen=="toolbox"){
isitOpen();
portfoliomc.gotoAndPlay("show");
}
}

servicesbtn.onRollOver=function(){
if(menuOpen=="services"){
null;
}
else if(menuOpen=="close" || menuOpen=="portfolio" || menuOpen=="information" || menuOpen=="toolbox"){
isitOpen();
servicesmc.gotoAndPlay("show");
}
}

informationbtn.onRollOver=function(){
if(menuOpen=="information"){
null;
}
else if(menuOpen=="close" || menuOpen=="portfolio" || menuOpen=="services" || menuOpen=="toolbox"){
isitOpen();
informationmc.gotoAndPlay("show");
}
}

toolboxbtn.onRollOver=function(){
if(menuOpen=="toolbox"){
null;
}
else if(menuOpen=="close" || menuOpen=="portfolio" || menuOpen=="services" || menuOpen=="information"){
isitOpen();
toolboxmc.gotoAndPlay("show");
}
}

var menuOpen:String="close";
function isitOpen(){
if(menuOpen=="services"){
menuOpen="close";
servicesmc.gotoAndPlay("hide");
}
else if(menuOpen=="portfolio"){
menuOpen="close";
portfoliomc.gotoAndPlay("hide");
}
else if(menuOpen=="information"){
menuOpen="close";
informationmc.gotoAndPlay("hide");
}
else if(menuOpen=="toolbox"){
menuOpen="close";
toolboxmc.gotoAndPlay("hide");
}
}
homebtn.onRollOver=function(){
isitOpen();
}
contactbtn.onRollOver=function(){
isitOpen();
}

My question is how would I make this work within my header_mc. If I take it out of the header_mc it works perfectly, however, it would be nice if I could contain all of the items inside of a movie clip.
kglad
Community Expert
Community Expert
February 22, 2008
the onMouseMove causes that hitTest to repeatedly execute so no other looping is needed.

you must remove all mouse handlers attached to header_mc.portfolio_mc. if you only define the positive hitTest arm of that conditional, you won't have any "rollout" behavior so you shouldn't see anything "blip in and out".
Inspiring
February 21, 2008
I tried implementing a hitTest into my code and it just made the movie clip blip in and out repeatedly. How would you make a loop? I apologize for troubling you all with rather basic questions, but I definitely need the help.
Inspiring
February 19, 2008
How could you use a loop or a hittest, I am really a beginner when it comes to Actionscript. Removing the parent mouse handler would be the following correct?
header_mc.portfolio_mc.gotoAndPlay("Portfolioexpand");
How could I get around this problem? All I really want to do is make it so that you can only access one drop down menu at a time.
kglad
Community Expert
Community Expert
February 20, 2008
your header_mc.portfolio_mc.goto method is not related to removing mouse handlers. your

header_mc.portfolio_mc.onRollOver = ...

is the parent mouse handler that could be part of the solution. the other parts would be ensuring there are no other mouse handlers for head_mc.portfolio_mc and creating your loop and checking for a hitTest. that could be something like:

kglad
Community Expert
Community Expert
February 15, 2008
i didn't make any suggestion. i just supplied the reason your child mouse handlers no longer work.

how you want to proceed is up to you. you can remove the parent mouse handler and use something else. or you can leave the parent mouse handler and use something other than mouse handlers for the child movieclips (like a loop and hittest).
Inspiring
February 15, 2008
So are you suggesting that I change the code to the following:

header_mc.portfolio_mc.onRollOver = function() {
_parent.header_mc.portfolio_mc.gotoAndPlay("Portfolioexpand");
_parent.header_mc.services_mc.gotoAndStop("collapsed");
_parent.header_mc.information_mc.gotoAndStop("Infocollapse");
_parent.header_mc.toolbox_mc.gotoAndStop("ToolBcollapse");
}

Or something else?
kglad
Community Expert
Community Expert
February 15, 2008
if you attach any mouse handlers to a parent movieclip that parent will intercept all mouse events so the child movieclips cannot respond.