# For Loop problem

**URL:** <https://forum.kirupa.com/t/for-loop-problem/286181>\
**Category:** flash\
**Created:** [April 11, 2009, 1:16pm UTC](https://forum.kirupa.com/t/for-loop-problem/286181 "2009-04-11T13:16:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fingermouse](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@fingermouse](https://forum.kirupa.com/u/fingermouse)\
**Post date:** [April 11, 2009, 1:16pm UTC](https://forum.kirupa.com/t/for-loop-problem/286181/1 "2009-04-11T13:16:12Z")

</div>

The trace action is giving the correct individual clip on rollover, and the correct frame based on the i variable but **this[“button”+i]** doesn’t seem to be assigning to control the instance on the goto action.

Could anybody help with this??

```auto
clips = 4;
for (var i = 1; i<=clips; i++) {
    this["button"+i].i = i;
    this["button"+i].onRollOver = function() {
  trace("clip"+[this.i]);
        "clip"+[this.i].gotoAndStop(this.i);
      
    };
}

```
