2 Replies Latest reply on Sep 5, 2014 8:26 AM by JotaSolano

    Timeline NOT playing onClick with setTimeout method

    JotaSolano

      Hello again,

       

      Following my streak of silly questions, I have yet another one. I tried asking on StackOverflow but the answer was unsuccessful. Basically I have a time function on the .compositionReady that triggers the timeline at specific time during the day. This timeline displays an animation and a dialogue with two buttons. One button (snooze_btn_sy) is supposed to "snooze" this dialogue and call the timeline again 10 minutes later (I have 4000 ms in the code just to test it). This is the code:

       

      .compositionReady:

       

      function snooze() {
        sym.play(1000);
        sym.snooze() = setTimeout(snooze(), 4000);
      }
      
      
      function updateClock() {
          var d = new Date(); // current date
                  var m = d.getMinutes();
          var h = d.getHours();
      
      
          console.log(h,":",m);
      
      
          // call this function again in 1000ms
          sym.updateClock = setTimeout(updateClock,1000);
      
      
          if(h== 9 && m== 45) { //at 9hrs 00 min 
      
      
      //run the dialogue for the morning pause
      sym.play(1000);
        }
      
      
        else {
        sym.stop(1000);
        }
      }
      
      
      updateClock(); // initial call
      

       

       

      snooze_btn_sy.click:

       

      sym.play();
      snooze();
      

       

      I got the other button to play another animation with just sym.play(); but the snooze button just won't do anything. I created a public function as you can see, and I call it in the snooze_btn_sy.click code.

       

       

      Any ideas?

       


      Thank you!