/***********************
* 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, "document", "compositionReady", function(sym, e) {
         // insert code to be run when the composition is fully loaded here
         $("#Stage_lado_1").css("background-color","transparent");
         $("#Stage_lado_2").css("background-color","transparent");
         $("#Stage_lado_3").css("background-color","transparent");
         
         
         $("[id^=Stage_hotspot_]").click(function(){
         	var idSeg = $(this).attr("id").slice(14);
         	var colorSeg = $("#Stage_lado_"+idSeg).css("background-color");
         	if(idSeg == 1){
         		$("#Stage_lado_1").css("background-color","rgb(255, 0, 0)");
         		$("#Stage_lado_3").css("background-color","rgb(255, 0, 0)");
         	}
         	if(idSeg == 2){
         		$("#Stage_lado_1").css("background-color","rgb(255, 0, 0)");
         		$("#Stage_lado_2").css("background-color","rgb(255, 0, 0)");
         	}
         	if(idSeg == 3){
         		$("#Stage_lado_2").css("background-color","rgb(255, 0, 0)");
         		$("#Stage_lado_3").css("background-color","rgb(255, 0, 0)");
         	}
         });
         
         
         //BOTÓN VALIDAR
         sym.$('hotspot_validar').click(function(){
         var correcto = 0;
         var colorLado1 = $("#Stage_lado_1").css("background-color");
         var colorLado2 = $("#Stage_lado_2").css("background-color");
         var colorLado3 = $("#Stage_lado_3").css("background-color");
         
         $(".angulos").css("pointer-events","none");
         
         if(colorLado1 == "rgb(255, 0, 0)" && colorLado2 == "rgb(255, 0, 0)" && colorLado3 != "rgb(255, 0, 0)"){
         	correcto = 1;
         }
         else if(colorLado1 == "rgb(255, 0, 0)" && colorLado3 == "rgb(255, 0, 0)" && colorLado2 != "rgb(255, 0, 0)"){
         	correcto = 1;
         }
         else if(colorLado2 == "rgb(255, 0, 0)" && colorLado3 == "rgb(255, 0, 0)" && colorLado1 != "rgb(255, 0, 0)"){
         	correcto = 1;
         }
         
         //Muestra las leyendas
         if(correcto==1){
         	sym.$("resp_correcta").show();
         	setTimeout('$("#Stage_resp_correcta").fadeOut("slow");', 2500);
         	//audio correcto
         	sym.$("success")[0].play();
         	sym.$("success")[0].muted = false;
         	//botones
         	sym.getSymbol("bt_validar").stop("down");
         	sym.getSymbol("bt_solucion").stop("down");
         	sym.getSymbol("bt_reiniciar").stop("normal");
         	sym.$("hotspot_validar").hide();
         	sym.$("hotspot_solucion").hide();
         	sym.$("hotspot_reiniciar").show();	
         }
         else{
         	//mensaje respuesta incorrecta
         	sym.$("resp_incorrecta").show();
         	setTimeout('$("#Stage_resp_incorrecta").fadeOut("slow");', 2500);
         	//audio incorrecto
         	sym.$("error")[0].play();
         	sym.$("error")[0].muted = false;
         	//botones
         	sym.$("hotspot_validar").hide();
         	sym.$("hotspot_solucion").show();
         	sym.$("hotspot_reiniciar").show();
         	sym.getSymbol("bt_validar").stop("down");
         	sym.getSymbol("bt_solucion").stop("normal");
         	sym.getSymbol("bt_reiniciar").stop("normal");
         }
         
         
         });
         //BOTÓN SOLUCIÓN
         sym.$('hotspot_solucion').click(function(){
         
         //botones
         sym.getSymbol("bt_validar").stop("down");
         sym.getSymbol("bt_solucion").stop("down");
         sym.getSymbol("bt_reiniciar").stop("normal");
         sym.$("hotspot_validar").hide();
         sym.$("hotspot_solucion").hide();
         sym.$("hotspot_reiniciar").show();
         
         $(".angulos").css("pointer-events","none");
         
         $("[id^=Stage_lado_]").css("background-color","transparent");
         $("#Stage_lado_1").css("background-color","rgb(255, 0, 0)");
         $("#Stage_lado_2").css("background-color","rgb(255, 0, 0)");
         
         //Oculta las leyendas
         sym.$("resp_correcta").hide();
         sym.$("resp_incorrecta").hide();
         
         });
         
         
         //BOTÓN REINICIAR
         sym.$('hotspot_reiniciar').click(function(){
         //botones
         	sym.getSymbol("bt_validar").stop("normal");
         	sym.getSymbol("bt_solucion").stop("down");
         	sym.getSymbol("bt_reiniciar").stop("down");
         	sym.$("hotspot_validar").show();
         	sym.$("hotspot_reiniciar").hide();
         	sym.$("hotspot_solucion").hide();  
         //Oculta las leyendas
         sym.$("resp_correcta").hide();
         sym.$("resp_incorrecta").hide();
         
         $(".angulos").css("pointer-events","auto");
         
         $("#Stage_lado_1").css("background-color","transparent");
         $("#Stage_lado_2").css("background-color","transparent");
         $("#Stage_lado_3").css("background-color","transparent");
         
         });
         
         
         //BOTÓN AYUDA
         sym.$('hotspot_ayuda').click(function(){
         // Definir un conmutador para ocultar o mostrar un elemento 
         if (sym.$("help").is(":visible")) {
         	sym.$("help").hide();
         	sym.getSymbol("bt_ayuda").stop("normal");
         } else {
         	sym.$("help").show();
         	sym.getSymbol("bt_ayuda").stop("down");
         }
         
         
         });
         // AYUDA
         sym.$('help').click(function(){
         sym.$("help").hide();
         sym.getSymbol("bt_ayuda").stop("normal");
         });
         
         

      });
      //Edge binding end

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

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

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

   //=========================================================
   
   //Edge symbol: 'bt_validar'
   (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

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

   //=========================================================
   
   //Edge symbol: 'bt_solucion'
   (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

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

   //=========================================================
   
   //Edge symbol: 'bt_reiniciar'
   (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

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

   //=========================================================
   
   //Edge symbol: 'bt_ayuda'
   (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

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

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

      });
      //Edge binding end

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

      });
      //Edge binding end

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

   //=========================================================
   
   //Edge symbol: 'parpado'
   (function(symbolName) {   
   
      Symbol.bindTriggerAction(compId, symbolName, "Default Timeline", 6045, function(sym, e) {
         sym.playReverse();

      });
      //Edge binding end

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

      });
      //Edge binding end

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

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

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

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