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

Hi all,

I have an array the code looks like this

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


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!