# Passing variable into onRelease

**URL:** <https://forum.kirupa.com/t/passing-variable-into-onrelease/205785>\
**Category:** Uncategorized\
**Created:** [November 1, 2006, 11:16pm UTC](https://forum.kirupa.com/t/passing-variable-into-onrelease/205785 "2006-11-01T23:16:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![litz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/litz/32/2966_2.png) [@litz](https://forum.kirupa.com/u/litz)\
**Post date:** [November 1, 2006, 11:16pm UTC](https://forum.kirupa.com/t/passing-variable-into-onrelease/205785/1 "2006-11-01T23:16:10Z")

</div>

I’m in need of a little help. I have a simple navigation, and each item is declared in the array below. The corrresponding movie clips also have the same instance name, and when each nav item is clicked, the movie should go to and play a frame that has a label containing the same name.

// names changed for client privacy  
var navItems = [“foo”, “bar”, “hot”, “chocolate”, “w00t”];

for (i=0; i \< navItems.length; i++) {  
caseStudySubNav[navItems\*].onRelease = function(){  
gotoAndPlay(navItems\*); // does nothing  
trace(navItems\*); // traces as undefined  
}  
trace(navItems\*); // traces the array values properly  
}

Everytime I click a menu item the trace returns as undefined. How do I get the value of navItems as it passes through the array attached/pushed to the onRelease function?

Thanks
