# Adding an array value to an instance name

**URL:** https://forum.kirupa.com/t/adding-an-array-value-to-an-instance-name/232113
**Category:** flash
**Created:** [July 11, 2007, 10:05am UTC](https://forum.kirupa.com/t/adding-an-array-value-to-an-instance-name/232113 "2007-07-11T10:05:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rushy2uk](https://avatars.discourse-cdn.com/v4/letter/r/f9ae1b/32.png) [@rushy2uk](https://forum.kirupa.com/u/rushy2uk)
#### Post date: [July 11, 2007, 10:05am UTC](https://forum.kirupa.com/t/adding-an-array-value-to-an-instance-name/232113/1 "2007-07-11T10:05:41Z")

</div>

This should be an easy one cos I think I’m close already.

Basically, I want to loop through an array and call the same method for each button instance. So instead of hardcoding this:

```auto
sections_mc.section **2**.alphaTo(10,.5,"easeoutquad");
sections_mc.section **3**.alphaTo(10,.5,"easeoutquad");
sections_mc.section **4**.alphaTo(10,.5,"easeoutquad");
sections_mc.section **5**.alphaTo(10,.5,"easeoutquad");
sections_mc.section **6**.alphaTo(10,.5,"easeoutquad");

```

I can use something like this:

```auto
for (i=0; i < sectionArray.length; i++) {
    sections_mc.section + **sectionArray*** + .alphaTo(10,.5,"easeoutquad");
}

```

I tried various things like concatenating the command and using eval:

```auto
eval("sections_mc.section" + sectionArray* + '.alphaTo(10,.5,"easeoutquad");';

```

However, none of my efforts worked.

Please could somebody help me?
