Show hide a movieclip with a listener?

Hi,

wondering if you can give me an example of a show/hide a movieclip with a listener. That is, i was planning to have a boolean flag variable showSubMenu and if it’s true the submenu will be visible and if false it’s hidden???

Example 1 using if conditional:

if (showSubMenu) {
	myMC._visible = true;
} else {
	myMC._visible = false;
}

Example 2 using ?: conditional:

showSubMenu ? myMC._visible = true : myMC._visible = false;

Example 3 using showSubMenu value:

myMC._visible = showSubMenu;

hmm, tx

i already have that. I am trying to find a solution for this


<?xml version="1.0" encoding="iso-8859-1"?>
<menu name="mainmenu">
	<submenu name="submenu A" gotoURL="">
		<item name="A 1" gotoURL="/a1"/>
		<item name="A 2" gotoURL="/a2"/>
		<item name="A 3" gotoURL="/a3"/>
	</submenu>
	<submenu name="submenu B" gotoURL="">
		<item name="B 1" gotoURL="/b1"/>
		<item name="B 2" gotoURL="/b2"/>
	</submenu>
	<item name="D" gotoURL="/d"/>
	<item name="E" gotoURL="/e"/>
	<submenu name="submenu F" gotoURL="">
		<item name="F 1" gotoURL="/f1"/>
		<item name="F 2" gotoURL="/f2"/>
		<item name="F 3" gotoURL="/f3"/>
	</submenu>
	<item name="G" gotoURL="/g"/>
</menu>

my submenu keeps disappearing when i click on one of the submenu items.

could you take a look

.fla is attach