# Array Question... i=0 or i=1

**URL:** <https://forum.kirupa.com/t/array-question-i-0-or-i-1/219295>\
**Category:** flash\
**Created:** [March 15, 2007, 2:22pm UTC](https://forum.kirupa.com/t/array-question-i-0-or-i-1/219295 "2007-03-15T14:22:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomyknoker](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@tomyknoker](https://forum.kirupa.com/u/tomyknoker)\
**Post date:** [March 15, 2007, 2:22pm UTC](https://forum.kirupa.com/t/array-question-i-0-or-i-1/219295/1 "2007-03-15T14:22:47Z")

</div>

Hi all,

I have an array the code looks like this

```auto
i = 1;
frames = new Array(38, 40, 42, 44, 46, 48);
this.onEnterFrame = function() {
    if (this._currentframe == frames*) {
        this["btn" + i].index = i+1;
        this["btn" + i].onRelease = function () {
           variable = this.index;
           this.play();
        		}
		this["btn" + i].index = i;
		this["btn" + i].onRelease = function() {
      	variable = this.index;
      	gotoAndPlay(51);
		};
        this["btn" + i].onRollOver = function() {
            delete this.onEnterFrame;
            this.play();
        };
        this["btn" + i].onRollOut = function() {
            this.onEnterFrame = function() {
                if (this._currentframe == 1) {
                    delete this.onEnterFrame;
                } else {
                    this.gotoAndStop(this._currentframe - 1);
                }
            };
        };
        i++;
    }
    if (this._currentframe == frames[frames.length]) {
        delete this.onEnterFrame;
    }
};

```

And this is what it calls when it gets to the frame

```auto

if (variable == 1) {
	gotoAndStop("btn1");
} else if (variable == 2) {
	gotoAndStop("btn2");
} else if (variable == 3) {
	gotoAndStop("btn3");
} else if (variable == 4) {
	gotoAndStop("btn4");
} else if (variable == 5) {
	gotoAndStop("btn5");
} else if (variable == 6) {
	gotoAndStop("btn6");
}

```

The problem is if I make ‘i=o’ the btn1 doesn’t work… If I make ‘i=1’ btn6 doesn’t work… I’m racking my brain but can’t work this one out!
