I'm trying to make an image gallery with ActionScript 2. The forward button works perfectly, but the backward button does not work. This is the code of the back button:
on(release){
var imgs:Array = new Array();
imgs[1] = {img: ImgBox1};
imgs[2] = {img: ImgBox2};
imgs[3] = {img: ImgBox3};
imgs[4] = {img: ImgBox4};
imgs[5] = {img: ImgBox5};
imgs[6] = {img: ImgBox6};
imgs[7] = {img: ImgBox7};
imgs[8] = {img: ImgBox8};
imgs[9] = {img: ImgBox9};
for(var i:Number = 9; i <= 1;i -= 1){
if(_global.contador <= 1){
return false;
}
if(_global.contador != i){
_root.imgs[i].img._visible = false;
}
if(_global.contador == i){
_root.imgs[i].img._visible = false;
_root.imgs[i-1].img._visible = true;
_global.contador = i-1;
return false;
}
}
}
What could be the problem? It is assumed that by pressing the forward button, _global.contador increases by 1, and at the time of using the backward one it should decrease by 1 if it matches.