clearscene does not reset everthing. If you have a function in the setTimeout it continues to run.
Also there is a strange problem with variables. When testing var myduration = 2; if I change myduration to 4. It does not change. when working with this code.
this.startTimer = function()
var start = Date.now();
var duration = 60 * this.mydur;
console.log("not updating"+ this.mydur);
var mytimer = function()
// get the number of seconds that have elapsed since
// startTimer() was called
diff = duration - (((Date.now() - start) / 1000) | 0);
// does the same job as parseInt truncates the float
minutes = (diff / 60) | 0;
seconds = (diff % 60) | 0;
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
_.TimerValue.getSprite().setText(minutes + "W"+this.mydur+"W:" + seconds);
if (diff <= 0)
// add one second so that the count down starts at the full duration
// example 05:00 not 04:59
this.myrunning = false;
when I close the browser and restart it, I had to go back and change the actual variable name to refresh the value. I can not think when that happens at all. You can see I had to go to mydur to use a new value.