# Show hide a movieclip with a listener?

**URL:** https://forum.kirupa.com/t/show-hide-a-movieclip-with-a-listener/260608
**Category:** Uncategorized
**Created:** [May 17, 2008, 12:35pm UTC](https://forum.kirupa.com/t/show-hide-a-movieclip-with-a-listener/260608 "2008-05-17T12:35:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)
#### Post date: [May 17, 2008, 12:35pm UTC](https://forum.kirupa.com/t/show-hide-a-movieclip-with-a-listener/260608/1 "2008-05-17T12:35:43Z")

</div>

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???

---

<div class="post-metadata">

### Author: ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)
#### Post date: [May 17, 2008, 1:26pm UTC](https://forum.kirupa.com/t/show-hide-a-movieclip-with-a-listener/260608/2 "2008-05-17T13:26:57Z")

</div>

Example 1 using if conditional:

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

```

Example 2 using ?: conditional:

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

```

Example 3 using showSubMenu value:

```auto
myMC._visible = showSubMenu;

```

---

<div class="post-metadata">

### Author: ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)
#### Post date: [May 17, 2008, 2:23pm UTC](https://forum.kirupa.com/t/show-hide-a-movieclip-with-a-listener/260608/3 "2008-05-17T14:23:00Z")

</div>

hmm, tx

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

```auto

<?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
