# Buttons in arrays - no action

**URL:** <https://forum.kirupa.com/t/buttons-in-arrays-no-action/259314>\
**Category:** Uncategorized\
**Created:** [May 3, 2008, 10:51am UTC](https://forum.kirupa.com/t/buttons-in-arrays-no-action/259314 "2008-05-03T10:51:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sol](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sol](https://forum.kirupa.com/u/sol)\
**Post date:** [May 3, 2008, 10:51am UTC](https://forum.kirupa.com/t/buttons-in-arrays-no-action/259314/1 "2008-05-03T10:51:45Z")

</div>

[SIZE=3][FONT=Times New Roman]I have 36 buttons I need action on. To avoid a lot of similar commands, I am trying to assign the button names in an array using a for loop. Tracing the array values, gives the correct button names, but there is no action when I press the buttons. If anyone can tell me the reason, I would really appreciate it. Thanks in advance![/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]Here is the code:[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]var farge\_btn\_tbl:Array = new Array(4); // Array assigning button instance names (works fine)[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman]var farge\_fr\_tbl:Array = new Array(4); // Array assigning frame label names (works fine)[/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[FONT=Times New Roman][SIZE=3] [/SIZE][/FONT]  
[SIZE=3][FONT=Times New Roman]for (var i:Number = 0; i \< 4; i++) {[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman] farge = “farge” + String(i+1); // The button instance names are assigned[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman] fargen = “fargen” + String(i+1); // The frame label names are assigned[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman] farge\_btn\_tbl\* = farge; // Placing the values in the button array[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman] farge\_fr\_tbl\* = fargen; // Placing the values in the frame array[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman] farge\_btn\_tbl\*.onRelease = function() { // Trying to get action on the buttons[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman] gotoAndStop(farge\_fr\_tbl\*); // it doesn’t work[/FONT][/SIZE]  
[SIZE=3][FONT=Times New Roman] } [/FONT][/SIZE]  
[FONT=Times New Roman][SIZE=3]}[/SIZE][/FONT]
