Tema: slide AS3
Ver Mensaje Individual
  #22 (permalink)  
Antiguo 01/11/2011, 14:15
david_qko
 
Fecha de Ingreso: marzo-2011
Ubicación: españa
Mensajes: 45
Antigüedad: 13 años, 1 mes
Puntos: 1
Respuesta: slide AS3

ok...aquí va:

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