/***********************
* Acciones de composición de Adobe Edge Animate
*
* Editar este archivo con precaución, teniendo cuidado de conservar 
* las firmas de función y los comentarios que comienzan con "Edge" para mantener la 
* capacidad de interactuar con estas acciones en Adobe Edge Animate
*
***********************/
(function($, Edge, compId){
var Composition = Edge.Composition, Symbol = Edge.Symbol; // los alias más comunes para las clases de Edge

   //Edge symbol: 'stage'
   (function(symbolName) {
      
      
      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      

      Symbol.bindElementAction(compId, symbolName, "${_button_2}", "click", function(sym, e) {
         // Mostrar un elemento 
         sym.$("msg_correcto").fadeIn("slow");
         
         // Ocultar un elemento 
         sym.$("msg_incorrecto").fadeOut("slow");
         
         sym.getSymbol("msg_correcto").play(1);
         sym.$("success")[0].play();
         
         
         // Mostrar un elemento 
         sym.$("check_1").fadeIn("slow");
         

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_button_1}", "click", function(sym, e) {
         // Mostrar un elemento 
         sym.$("msg_incorrecto").fadeIn("slow");
         
         // Ocultar un elemento 
         sym.$("msg_correcto").fadeOut("slow");
         
         sym.getSymbol("msg_incorrecto").play(1);
         sym.$("error")[0].play();
         
         sym.$("strake_1").fadeIn("slow");

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_button_3}", "click", function(sym, e) {
         // Mostrar un elemento 
         sym.$("msg_incorrecto").fadeIn("slow");
         
         // Ocultar un elemento 
         sym.$("msg_correcto").fadeOut("slow");
         
         sym.getSymbol("msg_incorrecto").play(1);
         sym.$("error")[0].play();
         
         sym.$("strake_2").fadeIn("slow");

      });
      //Edge binding end

   })("stage");
   //Edge symbol end:'stage'

   //=========================================================
   
   //Edge symbol: 'Precargador'
   (function(symbolName) {   
   
   })("Precargador");
   //Edge symbol end:'Precargador'

   //=========================================================
   
   //Edge symbol: 'flecha_bt'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         // introducir código aquí
         sym.stop();

      });
      //Edge binding end

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 250, function(sym, e) {
         // introducir código aquí
         sym.stop();

      });
      //Edge binding end

   })("flecha_bt");
   //Edge symbol end:'flecha_bt'

   //=========================================================

   //=========================================================

   //=========================================================
   
   //Edge symbol: 'bt_audio'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         // introducir código aquí
         sym.stop();

      });
      //Edge binding end

      Symbol.bindElementAction(compId, symbolName, "${_ht_spot}", "click", function(sym, e) {
         var soundId = sym.getSymbolElement().attr( "title" );
         var currentAudio=sym.getComposition().getStage().$(soundId)[0].currentTime;
         var duracion= sym.getComposition().getStage().$(soundId).duration;
         console.log("soundId="+soundId);
         if (duracion== currentAudio){
         sym.stop("up");
         }
         
         sym.getComposition().getStage().$(soundId).on('ended', function() {
         sym.stop("up");
            // enable button/link
         });
         
         console.log("currentAudio="+currentAudio);
         console.log("duracion="+duracion);
         // Definir un conmutador para reproducir o pausar una pista de audio 
         if (sym.getComposition().getStage().$(soundId)[0].paused) {
         	sym.getComposition().getStage().$(soundId)[0].play();
         	sym.getComposition().getStage().$(soundId)[0].volume=0.7;
         	sym.stop("down");
         
         } else {
         //activar para pausar en vez de reiniciar
         	sym.getComposition().getStage().$(soundId)[0].pause();
         	sym.stop("up");
         }

      });
      //Edge binding end

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 250, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

      

   })("bt_audio");
   //Edge symbol end:'bt_audio'

   //=========================================================
   
   //Edge symbol: 'msg_incorrecto'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

   })("msg_incorrecto");
   //Edge symbol end:'msg_incorrecto'

   //=========================================================
   
   //Edge symbol: 'msg_correcto'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         sym.stop();

      });
      //Edge binding end

   })("msg_correcto");
   //Edge symbol end:'msg_correcto'

   //=========================================================
   
   //Edge symbol: 'cientifico_002'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 10295, function(sym, e) {
         sym.play("head");

      });
      //Edge binding end

   })("cientifico_002");
   //Edge symbol end:'cientifico_002'

   //=========================================================
   
   //Edge symbol: 'cientifico_cabeza'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 6920, function(sym, e) {
         sym.play("eyes");

      });
      //Edge binding end

   })("cientifico_cabeza");
   //Edge symbol end:'cientifico_cabeza'

})(jQuery, AdobeEdge, "EDGE-94063035");