# Nav links don't work

**URL:** <https://forum.kirupa.com/t/nav-links-dont-work/63254>\
**Category:** Uncategorized\
**Created:** [September 4, 2004, 2:34pm UTC](https://forum.kirupa.com/t/nav-links-dont-work/63254 "2004-09-04T14:34:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kranekick](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kranekick](https://forum.kirupa.com/u/kranekick)\
**Post date:** [September 4, 2004, 2:34pm UTC](https://forum.kirupa.com/t/nav-links-dont-work/63254/1 "2004-09-04T14:34:28Z")

</div>

Can anyone tell me why my nav links aren’t working?  
I have 28 in total and they work fine when I use,

```auto

mcNavBtn1.onRelease = function() {
mcCheck1.gotoAndStop("on");
};

```

but, I don’t want to have to paste the code 28 times, so I’m trying this,

```auto

for(var i:Number = 1; i<29; i++) {
mcNavBtn*.onRelease = function() {
mcCheck*.gotoAndStop("on");
};
}

```

trace(mcNavBtn\*); //comes back as undefined  
I’ve also tried the following, which seems to be closer to working,

```auto

var btnArray:Array = new Array();
var checkArray:Array = new Array();
for(var i:Number = 1; i<29; i++) {
btnArray* = "mcNavBtn"+i;
checkArray* = "mcCheck"+i;
 
trace(btnArray*);
 
btnArray*.onRelease = function() {
checkArray*.gotoAndStop("on");
};
}

```

---

<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 5, 2004, 4:01am UTC](https://forum.kirupa.com/t/nav-links-dont-work/63254/2 "2004-09-05T04:01:06Z")

</div>

I still haven’t found a solution after 3 nights. Allow me to ask the question in simpler terms.

I have the following code,

```auto

mcNavBtn1.onRelease = function() { 
mcCheck1.gotoAndStop("on"); 
}; 
mcNavBtn2.onRelease = function() { 
mcCheck2.gotoAndStop("on"); 
}; 
mcNavBtn3.onRelease = function() { 
mcCheck3.gotoAndStop("on"); 
}; 
mcNavBtn4.onRelease = function() { 
mcCheck4.gotoAndStop("on"); 
}; 
mcNavBtn5.onRelease = function() { 
mcCheck5.gotoAndStop("on"); 
}; 

```

…

in such sequence 27 times!  
Could someone please tell me of a shorter way to write that?

---

<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 5, 2004, 7:49am UTC](https://forum.kirupa.com/t/nav-links-dont-work/63254/3 "2004-09-05T07:49:36Z")

</div>

For loops all the way 😉

```auto

for(var i=1;i<=28;i++){
var mc = this["mcNavBtn"+i];
mc.id = i;
mc.onRelease = function(){
this._parent["mcCheck"+this.id].gotoAndStop("on");
}
}

```

Supposing that the mcCheck movieclips are located next to the buttons in the hierarchy, not inside the buttons … change the path to fit your needs.
