Hello,
I’m doing a multi timer that shows 50 timers in 50 rows and I need to show in one dynamic Text Field the total time recorded from all timers.(totalSum). I’m an action script beginner that is learning from tutorials from the internet, may you please help me out on this work? See attachment. Thank you in advance.
//GLOBAL FUNCTION IN ONE LAYER
_global.stopWatch = function(){
this.time = 0;
this.start = function(){
clearInterval(this.watchID);
this.p = getTimer();
this.ctime = this.time;
var timer = function (stopwatch){
stopwatch.time = stopwatch.ctime + getTimer()- stopwatch.p;
};
this.watchID = setInterval(timer, 1, this);
};
this.stop = function(){
clearInterval(this.watchID);
};
this.reset = function(){
clearInterval(this.watchID);
this.time = 0;
}
this.toString = function(){
var ntime = this.time;
var hours = Math.floor(ntime/3600000);
ntime-=hours3600000;
var minutes = Math.floor(ntime/60000);
ntime-=minutes60000;
var seconds = Math.floor(ntime/1000);
ntime-=seconds*1000;
var milliseconds = ntime;
if(hours<10)hours = ‘0’+hours;
if(minutes<10)minutes = ‘0’+minutes;
if(seconds<10)seconds = ‘0’+seconds;
if(milliseconds<10)milliseconds = ‘0’+milliseconds;
return hours+’:’+minutes+’:’+seconds;
}
}
//TIMERS FUNCTION FROM FRAME 1 TO 50
myTimer1 = new stopWatch();
this.onEnterFrame = function(){
timeText1.text = myTimer1;
totalTimers.text = myTimer1;
}
start_1.onPress = function(){
myTimer2.start();
}
stop_1.onPress = function(){
myTimer2.stop();
}
reset_1.onPress = function(){
myTimer1.reset();
}
myTimer1.start();