# Buttons in for loop

**URL:** https://forum.kirupa.com/t/buttons-in-for-loop/224369
**Category:** Uncategorized
**Created:** [May 1, 2007, 8:40pm UTC](https://forum.kirupa.com/t/buttons-in-for-loop/224369 "2007-05-01T20:40:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vintage](https://avatars.discourse-cdn.com/v4/letter/v/e68b1a/32.png) [@vintage](https://forum.kirupa.com/u/vintage)
#### Post date: [May 1, 2007, 8:40pm UTC](https://forum.kirupa.com/t/buttons-in-for-loop/224369/1 "2007-05-01T20:40:30Z")

</div>

I do something wrong …but…I really dont see what…

```auto
for (i=0; i<5; i++) {
    this["haar"+i]._visible = false; //al mc's with the name "haar0 tm haar5" are invisible now 
}

for (b=0; b<5; b++) {
    this["h"+b].onRelease = function() {
        _root.naam = "haar"+substring(this._name, 2, -1);
        _root.naam._visible = true; //not working.....
        trace(naam); //correct on every release
    };
}

```

I tried like 50 combinations now, but none of them worked ☹  
All the instances are on the root, the buttons, the “haar#”, notthing is in another mc or something.

Anyone here that can point me into the right direction ?

Thx
