# Nested button inside MovieClips

**URL:** <https://forum.kirupa.com/t/nested-button-inside-movieclips/65053>\
**Category:** flash\
**Created:** [September 22, 2004, 4:59pm UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053 "2004-09-22T16:59:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![raheelm](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@raheelm](https://forum.kirupa.com/u/raheelm)\
**Post date:** [September 22, 2004, 4:59pm UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/1 "2004-09-22T16:59:25Z")

</div>

I am sure I must be doing something very stupid but here goes:

This is for a navigation bar.

- I have a main movie (mcMenu) on my stage which holds all the main buttons (btnHome, btnAbout, etc…).
- Inside mcMenu, when I roll over say btnAbout, the movie plays from 10 to 20th frames during which time a submenu fades into view.
- Inside this submenu, I have the sub-section buttons. It is these buttons that I am having problems with. Basically, I can’t get them to respond to onRelease events.

What could I be doing wrong?

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 22, 2004, 5:23pm UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/2 "2004-09-22T17:23:45Z")

</div>

What code are you using on the sub buttons?

:hr:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 22, 2004, 6:31pm UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/3 "2004-09-22T18:31:20Z")

</div>

I would guess that the problem lies in your pathing. When using event handlers on nested MC’s you must either use \_root to access the main timeline and continue your path from there or \_parent to access the MC that’s holding the sub-select buttons depending on what you’re trying to do.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 23, 2004, 3:14am UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/4 "2004-09-23T03:14:46Z")

</div>

> [@monkeyfresh](#):
>
> I would guess that the problem lies in your pathing. When using event handlers on nested MC’s you must either use \_root to access the main timeline and continue your path from there or \_parent to access the MC that’s holding the sub-select buttons depending on what you’re trying to do.

Thanks monkeyfresh and lunatic…

Well the code I have on the button is a pretty simple onRelease code for changing URL of the browser (this is all a navigation bar for a website).  
The code is (on the first frame of the submenu’s 1st layer):

```auto
subBtn1.onRelease = function():Void {
   getURL("someurl");
}

```

```auto

So the structure is like this:
Stage 
 |
 ---- Main_Menu_MC
        |
        ---- Main_Menu_Btns
        |
        ---- SubMenu_MCs
              |
              ----Sub_Menu_Btns (like subBtn1 above)

```

So, I am not accessing any MC higher up or anything from the nested submenu MC which holds these submenu buttons.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 23, 2004, 4:36am UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/5 "2004-09-23T04:36:27Z")

</div>

Make sure you use the whole path if you are using getURL to go to a website. Include the [http://www](http://www) - the whole bit.

If that doesn’t do it post again!

:hr:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 23, 2004, 4:46am UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/6 "2004-09-23T04:46:20Z")

</div>

> [@lunatic](#):
>
> Make sure you use the whole path if you are using getURL to go to a website. Include the [http://www](http://www) - the whole bit.
> 
> If that doesn’t do it post again!
> 
> :hr:

Thanks for the reply. No, that does not do it. Actually any code inside the onRelease button does nothing, including a simple ‘trace’ command.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 23, 2004, 4:48am UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/7 "2004-09-23T04:48:14Z")

</div>

[AS]subBtn1.onRelease = function():Void {  
\_root.getURL(“[http://www.siteName.com](http://www.siteName.com)”,"\_self");  
}[/AS]This should work.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 23, 2004, 2:55pm UTC](https://forum.kirupa.com/t/nested-button-inside-movieclips/65053/8 "2004-09-23T14:55:54Z")

</div>

> [@wizard](#):
>
> [AS]subBtn1.onRelease = function():Void {  
> \_root.getURL(“[http://www.siteName.com](http://www.siteName.com)”,“\_self”);  
> }[/AS]This should work.

Thanks Wizard.  
I figured out what the root of my problem was. ALthough I don’t know how to remmedy it totally. See I wanted to have a rollout effect on the submenus, so that when you rolled out of any submenu, the play would move to the first frame of the main movie. So on the frame that I had a submenu come up, I added a code like this:

```auto

mcAbout_submenu.onRollOut = function():Void {
	gotoAndStop("start");
}

```

Now, if I take out this bit of code, the buttons inside the submenu work! What I am doing wrong guys? And sorry for not explaining everything…

The file is here: [http://raheel.saebaan.com/iama\_menu\_nav.fla](http://raheel.saebaan.com/iama_menu_nav.fla)
