Tema: slide AS3
Ver Mensaje Individual
  #24 (permalink)  
Antiguo 01/11/2011, 14:48
Avatar de esdebon
esdebon
 
Fecha de Ingreso: agosto-2008
Ubicación: México
Mensajes: 167
Antigüedad: 15 años, 8 meses
Puntos: 18
Respuesta: slide AS3

Cambie tus "if" anidados

Por lo demas se ve bien el codigo, pero sospecho que el problema radica en el prevFrame (); de la funcion atras, es probable que en el frame 1 o en el 2 exista algun codigo que te regrese al frame 3 o re declare posiciones, porque a mi me funciona muy bien tu codigo, solo comente la parte de mascara.play();



Código actionscript:
Ver original
  1. import fl.transitions.Tween;
  2. import fl.transitions.easing.*;
  3.  
  4.  
  5. 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);
  6. var indice:int = 1;
  7. var numeroDeFotos = 10;
  8.  
  9.  
  10.  
  11. stop();
  12.  
  13.  
  14.  
  15. anterior.visible = false;
  16. siguiente.visible = true;
  17.  
  18. siguiente.addEventListener(Event.ENTER_FRAME, mostrar_botones);
  19. function mostrar_botones (e:Event){
  20.    
  21.         anterior.visible = true;
  22.         siguiente.visible = true;
  23.        
  24.         if(indice==1){
  25.             anterior.visible = false;
  26.         }
  27.        
  28.         if(indice==numeroDeFotos){
  29.             siguiente.visible = false;
  30.         }
  31. }
  32.  
  33.  
  34. siguiente.addEventListener(MouseEvent.CLICK, avanzar);
  35. function avanzar (e:MouseEvent){
  36.     nextFrame ();
  37.    // //mascara.play();
  38. }
  39.  
  40. anterior.addEventListener(MouseEvent.CLICK, atras);
  41. function atras (e:MouseEvent){
  42.     prevFrame ();
  43.    // //mascara.play();
  44. }
  45.  
  46.  
  47. boton1.addEventListener(MouseEvent.CLICK, imagen1 );
  48. function imagen1 (e:MouseEvent){
  49.     gotoAndStop(1);
  50.     //mascara.play();
  51. }
  52.  
  53. boton2.addEventListener(MouseEvent.CLICK, imagen2 );
  54. function imagen2 (e:MouseEvent){
  55.     gotoAndStop (2);
  56.     //mascara.play();
  57. }
  58.  
  59. boton3.addEventListener(MouseEvent.CLICK, imagen3 );
  60. function imagen3 (e:MouseEvent){
  61.     gotoAndStop (3);
  62.     //mascara.play();
  63. }
  64.  
  65. boton4.addEventListener(MouseEvent.CLICK, imagen4 );
  66. function imagen4 (e:MouseEvent){
  67.     gotoAndStop (4);
  68.         //mascara.play();
  69.         //mascara.play();
  70. }
  71.  
  72. boton5.addEventListener(MouseEvent.CLICK, imagen5 );
  73. function imagen5 (e:MouseEvent){
  74.     gotoAndStop (5);
  75.     //mascara.play();
  76. }
  77.  
  78. boton6.addEventListener(MouseEvent.CLICK, imagen6 );
  79. function imagen6 (e:MouseEvent){
  80.     gotoAndStop (6);
  81.     //mascara.play();
  82.  
  83. }
  84.  
  85. boton7.addEventListener(MouseEvent.CLICK, imagen7 );
  86. function imagen7 (e:MouseEvent){
  87.     gotoAndStop (7);
  88.     //mascara.play();
  89.  
  90. }
  91.  
  92. boton8.addEventListener(MouseEvent.CLICK, imagen8 );
  93. function imagen8 (e:MouseEvent){
  94.     gotoAndStop (8);
  95.     //mascara.play();
  96. }
  97.  
  98. boton9.addEventListener(MouseEvent.CLICK,imagen9);
  99. function imagen9 (e:MouseEvent){
  100.     gotoAndStop (9);
  101.     //mascara.play();
  102. }
  103.  
  104. boton10.addEventListener(MouseEvent.CLICK, imagen10 );
  105. function imagen10 (e:MouseEvent){
  106.     gotoAndStop (10);
  107.     //mascara.play();
  108. }
  109.  
  110.  
  111. boton1.addEventListener(MouseEvent.CLICK, sidebar);
  112. boton2.addEventListener(MouseEvent.CLICK, sidebar);
  113. boton3.addEventListener(MouseEvent.CLICK, sidebar);
  114. boton4.addEventListener(MouseEvent.CLICK, sidebar);
  115. boton5.addEventListener(MouseEvent.CLICK, sidebar);
  116. boton6.addEventListener(MouseEvent.CLICK, sidebar);
  117. boton7.addEventListener(MouseEvent.CLICK, sidebar);
  118. boton8.addEventListener(MouseEvent.CLICK, sidebar);
  119. boton9.addEventListener(MouseEvent.CLICK, sidebar);
  120. boton10.addEventListener(MouseEvent.CLICK, sidebar);
  121.  
  122. function sidebar(e:MouseEvent):void{
  123.     new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,e.currentTarget.x,1,true);
  124.     switch (e.target.name){
  125.         case "boton1" :
  126.             indice = 1;
  127.             break;
  128.         case "boton2" :
  129.             indice = 2;
  130.             break;
  131.         case "boton3"  :
  132.             indice = 3;
  133.             break;
  134.         case "boton4" :
  135.             indice = 4;
  136.             break;
  137.         case "boton5" :
  138.             indice = 5;
  139.             break;
  140.         case "boton6" :
  141.             indice = 6;
  142.             break;
  143.         case "boton7" :
  144.             indice = 7;
  145.             break;
  146.         case "boton8" :
  147.             indice = 8;
  148.             break;
  149.         case "boton9" :
  150.             indice = 9;
  151.             break;
  152.         case "boton10" :
  153.             indice = 10;
  154.             break;
  155.     }
  156.     trace(e.target.name)
  157.     trace("indice: "+indice)
  158. }  
  159. siguiente.addEventListener(MouseEvent.CLICK, sidebarNext)
  160.     function sidebarNext(e:MouseEvent):void
  161.     {
  162.         if (indice < numeroDeFotos)
  163.         {
  164.             trace("valor de indice Inicio: "+indice)
  165.             indice++;
  166.             new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,arreglo[indice],1,true);
  167.             trace("valor de indice Final: "+indice)
  168.         }
  169.  
  170.     }
  171.     anterior.addEventListener(MouseEvent.CLICK, sidebarBack)
  172.     function sidebarBack(e:MouseEvent):void
  173.     {
  174.         if (indice > 1)
  175.         {
  176.             trace("valor de indice Inicio: "+indice)
  177.             indice--;
  178.             new Tween(bar_mc,"x",Strong.easeOut,bar_mc.x,arreglo[indice],1,true);
  179.             trace("valor de indice Final: "+indice)
  180.         }
  181.  
  182.     }
__________________
Mi sitio: http://www.fluocode.com