# Looping through a button array

**URL:** <https://forum.kirupa.com/t/looping-through-a-button-array/30311>\
**Category:** Uncategorized\
**Created:** [September 6, 2003, 11:10pm UTC](https://forum.kirupa.com/t/looping-through-a-button-array/30311 "2003-09-06T23:10:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![j0se](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/j0se/32/44_2.png) [@j0se](https://forum.kirupa.com/u/j0se)\
**Post date:** [September 6, 2003, 11:10pm UTC](https://forum.kirupa.com/t/looping-through-a-button-array/30311/1 "2003-09-06T23:10:24Z")

</div>

hi all,

i have a bunch of buttons (with textboxes in them) on the stage, each called butt1, butt2, butt3, butt4 and i want to loop through them but i’m unsure how to target their text property inside the loop

this is what i have:

butt1.text = “button1”;  
butt2.text = “button2”;  
.  
.  
.

this is what i want to achieve:

// loop through the butonCount  
for (i=1; i’\<'buttonCount; i++) { //excuse the quotation binding the less-than sign

```
   butt*.text = "button" + i;		

```

}

it’s the butt\* bit that i’m unsure about

i tried holding the name in a var and then targetted its text prop like:

theButton = “butt” + i ;  
theButton.text = “button” + i;

but that doesn’t work (i guess it;s just a variable value and as such it has no properties

do i need to create a button array (?)

thanks all

:crazy:
