# Dependent Menus

**URL:** <https://forum.kirupa.com/t/dependent-menus/25814>\
**Category:** flash\
**Created:** [July 16, 2003, 7:30pm UTC](https://forum.kirupa.com/t/dependent-menus/25814 "2003-07-16T19:30:43Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![borispc](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@borispc](https://forum.kirupa.com/u/borispc)\
**Post date:** [July 16, 2003, 7:30pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/1 "2003-07-16T19:30:43Z")

</div>

Hi! Here goes: PLEASE HELP!!!

1. I have a set of menus (movieclips) with 2 states: active and inactive (frame labels). I want to be able to inactivate all the menus but the one clicked. Let’s say I have 3 menus and that are called m1,m2,m3.

2. The syntax for m1 would be something like this: (all inactivated and then the one clicked is activated)

on(release){  
for(i=1; i\<4; ++i){  
menu="\_parent.m"+i;  
menu.gotoAndStop(“inactive”);  
\_parent.m1.gotoAndStop(“active”);  
}  
//I know just doing this down here it works but I want to automate it…what if we had 30 buttons? The problem is menu.gotoAndStop(“inactive”). Menu gets the proper content in the loop…that is… \_parent.m1 , \_parent.m2, \_parent.m3.  
//\_parent.m1.gotoAndStop(“active”);  
//\_parent.m2.gotoAndStop(“inactive”);  
//\_parent.m3.gotoAndStop(“inactive”);  
}

---

<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:** [July 16, 2003, 7:38pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/2 "2003-07-16T19:38:18Z")

</div>

[AS]for (i=1; i\<4; ++i){  
menu = \_parent[“m”+i];  
menu.gotoAndStop(“inactive”);  
}  
this.gotoAndStop(“active”);[/AS]  
[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082)

---

<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:** [July 16, 2003, 10:24pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/3 "2003-07-16T22:24:18Z")

</div>

Great! that worked…now some other problem related to that changed appeared:  
those same menus that now work with each other create a conflict with the other actions in that same handler:

on(release){  
\_global.picNum=4;  
\_global.path = “portfolio/interiors/02/”;  
\_global.pic1=1;  
\_global.pic2=2;  
loadMovie(“portfolio/templates/2pics.swf”, “\_root.c\_holder”, “GET”);  
for(x=1; x\<3; ++x){  
allMenus=\_parent[“n”+x];  
allMenus.gotoAndStop(“inactive”);  
}  
this.gotoAndStop(“active”);  
}

The dependent menus still work but the movie that was being loaded in the main movie inside a movieclip called c\_holder is only loaded the first time the button is clicked…when you click again it doesn’t load anymore.  
Note: Every menu (n1,n2,…) loads a different movie in c\_holder.

---

<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:** [July 16, 2003, 10:33pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/4 "2003-07-16T22:33:21Z")

</div>

oh I forgot…  
if you take out the new for function of the buttons…loading the movies works fine so it’s probably related with some value created after the first click.  
thanks again…

---

<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:** [July 16, 2003, 11:29pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/5 "2003-07-16T23:29:22Z")

</div>

Ehmm… everything seems to be fine in your code. :-\

Could you attach your FLA?

---

<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:** [July 16, 2003, 11:34pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/6 "2003-07-16T23:34:42Z")

</div>

here goes the menu…you won’t really see it working (loading movies) because this is just the menu movie…not the entire site…(it would be too much)…  
hopefully it’ll be enough for someone to solve it…thanx!!!

the first level navigation works (portrait, lifestyle, etc) but the numbers for every section are the ones that have that problem. Go to Interiors. 🙂

---

<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:** [July 16, 2003, 11:57pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/7 "2003-07-16T23:57:32Z")

</div>

You want to load the external SWF into the MovieClip instance _c\_holder_. The thing is, that instance doesn’t exists in the movie, so how do you expect it to load the SWF… ? :-\

---

<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:** [July 17, 2003, 1:01am UTC](https://forum.kirupa.com/t/dependent-menus/25814/8 "2003-07-17T01:01:31Z")

</div>

Ok. Here is how it works. I didn’t attach all the files!!!  
There is a main movie that has that c\_holder movieclip. The main movie loads that external menu (file attached) at some point. And the numbers in that menu load another external movie in the main movie inside that movieclip. The thing works without that for() function in the numbers. It does work with the function in the menus (portrait, lifestyle, etc).  
If you are still confused I could send you a link. Hope this makes sense.  
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:** [July 17, 2003, 1:07am UTC](https://forum.kirupa.com/t/dependent-menus/25814/9 "2003-07-17T01:07:24Z")

</div>

Of course you didn’t attach all the files, I know that.

What I’m saying is that the MovieClip where the SWF should be loaded doesn’t exists!! 😛

Just trace it. Add this line of code to the Button Actions:  
[AS]trace(\_root.c\_holder);[/AS]  
It will return undefined in the Output Window, which means that either the MovieClip is not there or the instance name is wrong.

---

<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:** [July 17, 2003, 1:10am UTC](https://forum.kirupa.com/t/dependent-menus/25814/10 "2003-07-17T01:10:49Z")

</div>

you don’t seem to understand how it works. This movie you have is loaded inside tha main movie. So the \_root. absolute path does not correspond to the main timeline of the menu but the main timeline of the main movie. Of course you can’t test that function unless you see the movie loaded in the main movie not by itself.  
If you want to see it work go to:  
[www.deborahjaffe.com](http://www.deborahjaffe.com) (then click portfolio and that menu is loaded at the bottom, you’ll see that it works just like that).  
Thanks again.

---

<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:** [July 17, 2003, 1:15am UTC](https://forum.kirupa.com/t/dependent-menus/25814/11 "2003-07-17T01:15:21Z")

</div>

OMG then attach that FLA too!! 😛

How on earth can I fix something that I don’t have!? :-\

---

<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:** [July 17, 2003, 1:18am UTC](https://forum.kirupa.com/t/dependent-menus/25814/12 "2003-07-17T01:18:25Z")

</div>

I’m sorry but I can’t do that because I don’t have that file with me right now (I’m not at work :trout: )  
I thought you could take a look and see if you can guess what it is. I’ll try to post that file…:block:

---

<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:** [July 17, 2003, 1:26am UTC](https://forum.kirupa.com/t/dependent-menus/25814/13 "2003-07-17T01:26:58Z")

</div>

to see the thing work you would need a bunch of movies and external jpegs…and stuff ☹

---

<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:** [July 17, 2003, 1:29am UTC](https://forum.kirupa.com/t/dependent-menus/25814/14 "2003-07-17T01:29:12Z")

</div>

That’s not a problem. I can _fake_ them.

---

<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:** [July 17, 2003, 5:41pm UTC](https://forum.kirupa.com/t/dependent-menus/25814/15 "2003-07-17T17:41:14Z")

</div>

hi! if someone is still there…I created dummy movies for everything to work and this is the error I get when I click on the button the second time:  
Error opening URL “file:///…2pics.swf?x=4&allMenus=%5Flevel0%2Em%5Fholder%2En3”

So I don’t know how it’s getting all that extra text after 2pics.swf  
Any ideas?
