Lo he probado y nose porque pero cuando llega a la 10 se va directamente a la 3
Código ASP:
Ver originalvar arreglo:Array = new Array(0,boton1.x,boton2.x,boton3.x,boton4.x,boton5.x,
boton6.x,boton7.x,boton8.x,boton9.x,boton10.x);
var indice:int = 1;
var numeroDeFotos = 10;
boton1.addEventListener(MouseEvent.CLICK, sidebar);
boton2.addEventListener(MouseEvent.CLICK, sidebar);
boton3.addEventListener(MouseEvent.CLICK, sidebar);
boton4.addEventListener(MouseEvent.CLICK, sidebar);
boton5.addEventListener(MouseEvent.CLICK, sidebar);
boton6.addEventListener(MouseEvent.CLICK, sidebar);
boton7.addEventListener(MouseEvent.CLICK, sidebar);
boton8.addEventListener(MouseEvent.CLICK, sidebar);
boton9.addEventListener(MouseEvent.CLICK, sidebar);
boton10.addEventListener(MouseEvent.CLICK, sidebar);
function sidebar(e:MouseEvent):void{
new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,e.currentTarget.x,1,true);
switch (e.target.name){
case boton1 :
indice = 1;
break;
case boton2 :
indice = 2;
break;
case boton3 :
indice = 3;
break;
case boton4 :
indice = 4;
break;
case boton5 :
indice = 5;
break;
case boton6 :
indice = 6;
break;
case boton7 :
indice = 7;
break;
case boton8 :
indice = 8;
break;
case boton9 :
indice = 9;
break;
case boton10 :
indice = 10;
break;
}
}
siguiente.addEventListener(MouseEvent.CLICK, sidebarNext)
function sidebarNext(e:MouseEvent):void
{
if (indice < 10)
{
indice++;
new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,arreglo[indice],1,true);
}
}
anterior.addEventListener(MouseEvent.CLICK, sidebarBack)
function sidebarBack(e:MouseEvent):void
{
if (indice > 1)
{
indice--;
new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,arreglo[indice],1,true);
}
}