I’m trying to make a timer for a movie, so far i have AS like this on a MC that is playing…
[AS]
onClipEvent(enterFrame) {
timer = getTimer()
rtime = Math.round(timer/1000)
_root.frameText.text = "Current Frame: " + _currentframe;
_root.timebox.text = "Seconds elapsed: " + rtime;
}
[/AS]
What i want to know… How can i get the timer to stop counting when this mc gets to the last frame ? and restart when if it’s played over again.
system
December 29, 2003, 9:14am
2
well this fixes it so that it stops counting when it gets to the last frame.
For example if your last frame was 85 then you would use this
[AS]
onClipEvent(enterFrame) {
if (_currentframe < 85) {
timer = getTimer();
rtime = Math.round(timer/1000);
}
_root.frameText.text = "Current Frame: " + _currentframe;
_root.timebox.text = "Seconds elapsed: " + rtime;
}
[/AS]
I have no clue how to make it restart though…
system
December 29, 2003, 9:18am
3
Thanks DigiGamer, You’re my hero.
system
December 29, 2003, 9:38am
4
onClipEvent(enterFrame) {
if (_currentframe < _totalframes) {
timer = getTimer();
rtime = Math.round(timer/1000);
}
_root.frameText.text = "Current Frame: " + _currentframe;
_root.timebox.text = "Seconds elapsed: " + rtime;
}
im not a big fan of getTimer, but hey, whatever works. (i’d rather use setInterval).
system
December 29, 2003, 9:41am
5
thats what i have now, but how can i get it to restart when the MC restarts?
system
December 29, 2003, 10:03am
6
onClipEvent (load) {
seconds = 0;
function refreshTimer() {
seconds++;
if (_currentframe == _totalframes) {
seconds = 0;
}
rtime = Math.round(seconds / 1000);
_root.frameText.text = "Current Frame: " + _currentframe;
_root.timebox.text = "Seconds elapsed: " + rtime;
}
timer = setInterval(refreshTimer, 1);
}
system
December 29, 2003, 10:26pm
7
did you test that?? doesn’t seem to work for me