# Simple function not working. Please help :)

**URL:** <https://forum.kirupa.com/t/simple-function-not-working-please-help/66561>\
**Category:** flash\
**Created:** [October 6, 2004, 9:29pm UTC](https://forum.kirupa.com/t/simple-function-not-working-please-help/66561 "2004-10-06T21:29:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsears](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jsears](https://forum.kirupa.com/u/jsears)\
**Post date:** [October 6, 2004, 9:29pm UTC](https://forum.kirupa.com/t/simple-function-not-working-please-help/66561/1 "2004-10-06T21:29:49Z")

</div>

I have 12 nav items. When you rollover them, a flyout subnav appears, and several other things take place, so I can’t use a simple roll over. I want to call a function that will use a loop to turn off all the nav items except the one currently rolled over. When a button is rolled over, I set a variable named “state” to a number, then call this function.

function killNav(state) {  
for (i=0; i\<13; i++) {  
if (state==i) {  
("\_root.mcTopNav" + i ).gotoAndStop(2);  
}  
else {  
("\_root.mcTopNav" + i ).gotoAndStop(1);  
}  
}  
}

which doesn’t work. The loop works, I can get it to trace out stuff, but none of my buttons (mcTopNav1 through 12) don’t do anything. Any help?
