import fl.transitions.Tween;
import fl.transitions.easing.*;
var 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;
stop();
anterior.visible = false;
siguiente.visible = false;
siguiente.addEventListener(Event.ENTER_FRAME, mostrar_botones);
function mostrar_botones (e:Event){
if(mouseX > 69){
if(mouseX < 570){
if(mouseY > 62){
if(mouseY < 417){
anterior.visible = true;
siguiente.visible = true;
}else{
anterior.visible = false;
siguiente.visible = false;
}
}else{
anterior.visible = false;
siguiente.visible = false;
}
}else{
anterior.visible = false;
siguiente.visible = false;
}
}else{
anterior.visible = false;
siguiente.visible = false;
}
}
siguiente.addEventListener(MouseEvent.CLICK, avanzar);
function avanzar (e:MouseEvent){
nextFrame ();
mascara.play();
}
anterior.addEventListener(MouseEvent.CLICK, atras);
function atras (e:MouseEvent){
prevFrame ();
mascara.play();
}
boton1.addEventListener(MouseEvent.CLICK, imagen1 );
function imagen1 (e:MouseEvent){
gotoAndStop(1);
mascara.play();
}
boton2.addEventListener(MouseEvent.CLICK, imagen2 );
function imagen2 (e:MouseEvent){
gotoAndStop (2);
mascara.play();
}
boton3.addEventListener(MouseEvent.CLICK, imagen3 );
function imagen3 (e:MouseEvent){
gotoAndStop (3);
mascara.play();
}
boton4.addEventListener(MouseEvent.CLICK, imagen4 );
function imagen4 (e:MouseEvent){
gotoAndStop (4);
mascara.play();
mascara.play();
}
boton5.addEventListener(MouseEvent.CLICK, imagen5 );
function imagen5 (e:MouseEvent){
gotoAndStop (5);
mascara.play();
}
boton6.addEventListener(MouseEvent.CLICK, imagen6 );
function imagen6 (e:MouseEvent){
gotoAndStop (6);
mascara.play();
}
boton7.addEventListener(MouseEvent.CLICK, imagen7 );
function imagen7 (e:MouseEvent){
gotoAndStop (7);
mascara.play();
}
boton8.addEventListener(MouseEvent.CLICK, imagen8 );
function imagen8 (e:MouseEvent){
gotoAndStop (8);
mascara.play();
}
boton9.addEventListener(MouseEvent.CLICK,imagen9);
function imagen9 (e:MouseEvent){
gotoAndStop (9);
mascara.play();
}
boton10.addEventListener(MouseEvent.CLICK, imagen10 );
function imagen10 (e:MouseEvent){
gotoAndStop (10);
mascara.play();
}
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;
}
trace(e.target.name)
trace("indice: "+indice)
}
siguiente.addEventListener(MouseEvent.CLICK, sidebarNext)
function sidebarNext(e:MouseEvent):void
{
if (indice < numeroDeFotos)
{
trace("valor de indice Inicio: "+indice)
indice++;
new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,arreglo[indice],1,true);
trace("valor de indice Final: "+indice)
}
}
anterior.addEventListener(MouseEvent.CLICK, sidebarBack)
function sidebarBack(e:MouseEvent):void
{
if (indice > 1)
{
trace("valor de indice Inicio: "+indice)
indice--;
new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,arreglo[indice],1,true);
trace("valor de indice Final: "+indice)
}
}
muchas gracias por la ayuda¡¡