0 Replies Latest reply on Sep 9, 2015 11:24 AM by -david

    Clear interval when a button is clicked

    -david

      Hi all,

       

      I'm on EA CC2015

       

      Any idea on this ???

       

      Frame 1 code (will go to play frame 3 after 5 seconds) <-- and it works :

       

      sym.stop();

      var counter_delay = 1000;

      var min_count = 0;

      var present_count = 5;

      var timer = window.setInterval(stepUp,counter_delay);

      function stepUp(){

      present_count--;

      // Change the text of an element

      sym.$("Text").html(present_count);

      if(present_count==min_count){

      //alert("5 seconds over");

      clearInterval(timer);

      sym.play(3);

      }}

       

      Frame 1 button code (have to stop the counter and go to play frame 2) <-- it works, exept the counter is still running and will go to frame 3 after 2 or 3 seconds on the frame 2 :

       

      sym.play(2);

      //i have to put the code here for stopping the counter... (something that will tell the root to clear interval)

       

      Thanks for your help...!!

       

      -david