Hi all,
I am doing a small game in flash in which their is a functionality. However, the script which I got online does not work when placed inside a movie clip. therefore, I made some animation outside in the main frame and start the timer.
Below is the code which has been used in the actions layer with the 00:00:00:00 with "timer_txt" as the variable name.
startTime = getTimer();
onEnterFrame = function () {
elapsedTime = getTimer()-startTime;elapsedHours = Math.floor(elapsedTime/3600000);
remaining = elapsedTime-(elapsedHours*3600000);elapsedM = Math.floor(remaining/60000);
remaining = remaining-(elapsedM*60000);elapsedS = Math.floor(remaining/1000);
remaining = remaining-(elapsedS*1000);elapsedH = Math.floor(remaining/10);
if (elapsedHours<10) {hours = "0"+elapsedHours.toString();
}
else {hours = elapsedHours.toString();
}
if (elapsedM<10) {minutes = "0"+elapsedM.toString();
}
else {minutes = elapsedM.toString();
}
if (elapsedS<10) {seconds = "0"+elapsedS.toString();
}
else {seconds = elapsedS.toString();
}
if (elapsedH<10) {hundredths = "0"+elapsedH.toString();
}
else {hundredths = elapsedH.toString();
}
_root.timer_txt = hours+":"+minutes+":"+seconds+":"+hundredths;
};
Now, once the Movieclip starts the timer starts but it also has to stop once this mission is accomplished.
Can you please help me to get the action script for the stop button which has to pause the digital timer on the main frame and display that it is the final time on the main screen. Please help
Thanks in advance!!






Bookmarks