# Array value inside function is 'undefined'

**URL:** <https://forum.kirupa.com/t/array-value-inside-function-is-undefined/89023>\
**Category:** Uncategorized\
**Created:** [May 4, 2005, 12:27pm UTC](https://forum.kirupa.com/t/array-value-inside-function-is-undefined/89023 "2005-05-04T12:27:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakob](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/yakob/32/348_2.png) [@yakob](https://forum.kirupa.com/u/yakob)\
**Post date:** [May 4, 2005, 12:27pm UTC](https://forum.kirupa.com/t/array-value-inside-function-is-undefined/89023/1 "2005-05-04T12:27:59Z")

</div>

hey out there, this is doin me head in and i’m sure it’s simple:

two arrays, one for button names, one for icon value which happens when the button is clicked.

this works

```auto

btnName = new Array("e_one", "e_two", "e_three", "e_four", "e_five", "e_six", "e_seven", "e_eight", "e_nine", "e_ten");
btnIcon = new Array("e_movies", "e_tv", "e_audio", "e_radio", "e_games", "e_six", "e_seven", "e_eight", "e_nine", "e_ten");
for (i=0; i<10; i++) {
	this[btnName*].onPress = function() {
		btnPos = btnIcon*;
		trace(btnIcon*);
	};
}

```

but i get ‘undefined’ as the ‘btnPos’ value.

i think i need something different in the:

```auto

btnPos = btnIcon*;

```

bit but i cant figure out what??

any suggestions to this would be grand,

cheers,

jake
