5 Replies Latest reply on Jul 28, 2015 5:18 AM by resdesign

    Clicking back button shows screen in it's last/finished state

    Corrie1000 Level 1

      Hi,

       

      I've created a simple counter that counts up to 30 in 5s (i.e. 5, 10, 15, 20......) and down again using up and down buttons and the following code in my Stage actions:

       

      var mylabels = ['setup','setup_5','setup_10','setup_15','setup_20','setup_25','setup_30'];

      var i=0;

      sym.$('setup_up_btn2').click(function(){

      i++;

      sym.stop(mylabels[i]);  // plays the labels in a symbol

      });

      sym.$('setup_down_btn2').click(function(){

      i--;

      sym.stop(mylabels[i]);

      });

       

      However, if I navigate away from this page using one of the other buttons I've created on this page, then come back again, the counter stops working.

      To return to this page with the counter, my other pages have a button that is coded to go to the label called 'setup' i.e. the first in my list of labels in the code above.

       

      Does anyone know why my counter doesn't reset and function as if it's my first visit to the page?

       

      Thanks for your help in advance.

      Corrie