Page 1 of 1

Timer re-starts after page change HTML5

PostPosted: Wed Mar 23, 2016 10:59 am
by Nav
This question was posted previously, but was lost during a server migration. Reposting for posterity.

Hello,
I made a couple of question sets in one course that need to be timed. I made the timer on the master page and once the first question set is opened the timer starts. It stops when all question sets are finished (based on global variables) or when the time runs out. The function works perfectly untill I convert it to HTML5. In HTML5 it resets the timer on every page change. Does anyone knows how to solve this?

Re: Timer re-starts after page change HTML5

PostPosted: Wed Mar 23, 2016 10:59 am
by Nav
Hi Richard,
The timer doesn't seem to reset in HTML5 when the page changes when I built a simple case (just a timer on the Master Page and watching it count down as I switch pages). Maybe there is something in the logic that starts the timer that is behaving differently in Flash vs HTML5. Can you email us the name of the lesson, and which page of the lesson the timer starts? We'll create a copy and take a closer look.

Re: Timer re-starts after page change HTML5

PostPosted: Wed Mar 23, 2016 11:00 am
by Nav
Hello Nav,
Thank you for the quick reply. The lesson name is [redacted]. If you publish the lesson on page 3 (index) you first have to do the "warm up lap" (question set on page 4) to activate the other question sets. If you then open one of the other sets the timer will be activated. The timer functionalities can be found in the master page in the "timer" folder.
BR, Richard

Re: Timer re-starts after page change HTML5

PostPosted: Wed Mar 23, 2016 11:01 am
by Nav
Hi Richard,
It seems like the "Timer1.show" action is what causes this. Technically, with the action you have, it is trying to show a Timer that is already visible, which resets it. This is a bug, which I'll log. However, it may be a little while before it's fixed, so here is a workaround in the meantime.

What you can do is add to the condition that you already have to only show the timer if it is not currently visible. That keeps the show action from firing multiple times (basically the timer is never hidden, so it continues to show). I tested a copy of your lesson, and it seems to work. I'm not sure if this has any side effects to the other responses in that action. Let me know if this works for you!

timeraction.png
timeraction.png (21.24 KiB) Viewed 20313 times

- Nav

Re: Timer re-starts after page change HTML5

PostPosted: Wed Mar 23, 2016 11:02 am
by Nav
Hi Nav,
Thank you for helping me out with this. It is always very time consuming if you have issues after the HTML5 conversion. I changed it according to your suggestion and so far it fucntions fine! I will do some more testing next week.
Thanks!

Not able to open ./cache/data_global.php