/***********************
* 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.bindSymbolAction(compId, symbolName, "creationComplete", function(sym, e) {
         slideCount = 1;
         //cambiar según el número de slides
         var numOfSlides = 4;
         //sym.$("textCount").html(slideCount+ "of " + numOfSlides);
         sym.getSymbol("slide_"+slideCount).stop(0);
         sym.showSlide = function (slideDirection){
         	slideCount = slideCount + slideDirection;
            sym.getComposition().getStage().stop("slide_"+slideCount);
            sym.getSymbol("slide_"+slideCount).stop(0);
         	//Beyond 22, change to 1
         	if (slideCount < numOfSlides){ 
         	sym.$('bt_next').css("visibility","visible");
         	}
         	if (slideCount == numOfSlides){
         	slideCount = numOfSlides;
         	sym.$('bt_next').css("visibility","hidden");
         	} 
         	if (slideCount <= 1){ 
         	sym.setVariable("slideCount", 1);
         }
         }
         //se definen las variables de los simbolos
         
         var btNext = sym.getSymbol("bt_next").$("hotspot_area_next");
         var btBack = sym.getSymbol("bt_back").$("hotspot_area_back");
         // Mostrar un elemento
         
         // Mostrar un elemento 
         
         
         btBack.bind("click", function() {
         if (slideCount > 1){ 
         	sym.getComposition().getStage().showSlide(-1);
         }
         });
         btBack.bind("mouseup", function() {
         sym.getSymbolElement.stop("up");
         });
         btBack.bind("mouseout", function() {
         sym.getSymbol("bt_back").stop("normal");
         });
         
         btBack.bind("mousedown", function() {
         sym.getSymbol("bt_back").stop("down");
         });
         
         btBack.bind("mouseover", function() {
         sym.getSymbol("bt_back").stop("over");
         });
         
         btNext.bind("click", function() {
         	sym.getComposition().getStage().showSlide(1);
         });
         btNext.bind("mouseup", function() {
         sym.getSymbolElement.stop("up");
         });
         btNext.bind("mouseout", function() {
         sym.getSymbol("bt_next").stop("normal");
         });
         
         btNext.bind("mousedown", function() {
         sym.getSymbol("bt_next").stop("down");
         });
         
         btNext.bind("mouseover", function() {
         sym.getSymbol("bt_next").stop("over");
         });

      });
      //Edge binding end
      
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         sym.stop();
         //cargar actividad-reemplazar la carpeta según el código - cambiar el simbolo de acuerdo a donde carga
         
         //EC.loadComposition("composiciones/01_01/index.html", sym.getSymbol('slide_1'));
         
         //textos
         $(sym.lookupSelector("momento")).html("DESARROLLO");
         $(sym.lookupSelector("num_actividad")).html("Actividad 3");
         $(sym.lookupSelector("descripcion")).html("Lorem ipsum dolor sit amet, consectetur");
         $(sym.lookupSelector("instruccion")).html("Lorem ipsum dolor sit amet, consectetur");

      });
      //Edge binding end
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      

      

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

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

   //=========================================================
   
   //Edge symbol: 'bt_next'
   (function(symbolName) {   
   
      

      

      

      

      

      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         // introducir código aquí
      });
      //Edge binding end

      

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

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

      });
      //Edge binding end

      

      

      

      

      

      

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

   //=========================================================
   
   //Edge symbol: 'slide_5'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 0, function(sym, e) {
         //CAMBIAR ESTA OPCIÓN A PLAY SI SE DESEA INICIAR LA ANIMACIÓN O SI ES IMAGEN FIJA PONERLA EN STOP 
         sym.stop();

      });
      //Edge binding end

      

      

      

      

      

      

      

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

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

      });
      //Edge binding end

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

      });
      //Edge binding end

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

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

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

   //=========================================================
   
   //Edge symbol: 'bg_content'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 5641, function(sym, e) {
         sym.getSymbol("mariposa_02").getSymbol("alas_02").stop(0);
         sym.getSymbol("mariposa_03").getSymbol("vuelo_03").stop(0);

      });
      //Edge binding end

      

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

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

   //=========================================================
   
   //Edge symbol: 'boca_nina'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 3300, function(sym, e) {
         // introducir código aquí
         // Reproducir la línea de tiempo en un momento o etiqueta específicos. Por ejemplo:
         // sym.play(500); o sym.play("myLabel");
         sym.play("inicio");

      });
      //Edge binding end

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

   //=========================================================
   
   //Edge symbol: 'panel'
   (function(symbolName) {   
   
      

      

      

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

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

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

   //=========================================================
   
   //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");
         	
         	sym.getComposition().getStage().getSymbol("bg_content").getSymbol("farmGirl2").getSymbol("head").getSymbol("boca_nina").stop();
         	
            // 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");
         	sym.getComposition().getStage().getSymbol("bg_content").getSymbol("farmGirl2").getSymbol("head").getSymbol("boca_nina").play();
         } else {
         //activar para pausar en vez de reiniciar
         	sym.getComposition().getStage().$(soundId)[0].pause();
         	sym.stop("up");
         	sym.getComposition().getStage().getSymbol("bg_content").getSymbol("farmGirl2").getSymbol("head").getSymbol("boca_nina").stop();
         }

      });
      //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: 'mariposa01_alas'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 419, function(sym, e) {
         sym.play("alas_01");

      });
      //Edge binding end

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

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

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

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

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

      });
      //Edge binding end

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

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

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

      });
      //Edge binding end

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

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

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

   //=========================================================
   
   //Edge symbol: 'CABRA'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 18000, function(sym, e) {
         sym.play("inicio");

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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

      });
      //Edge binding end

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

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