Hi everybody,
I’m making a game that have a countdown, but I need it to stop when I change frame.
For example, it starts at 5:00’’ countdown when when I change frame at 3:21’’ it should stop on this value.
Is this possible? It’s possible to stop it?
Here goes the code I’m using (I’ve searched in kirupa foruns, google, etc… and haven’t finded any solution):
[AS]
var seconds = 5;
var miliseconds = 10;
function tellTime() {
if (miliseconds<10) {
time_txt.text = seconds+":"+“0”+miliseconds+" ‘’";
} else {
time_txt.text = seconds+":"+miliseconds+" ‘’";
}
miliseconds–;
if (miliseconds<0) {
miliseconds = 10;
seconds–;
}
if (seconds<0) {
clearInterval(id);
time_txt.text = “0”;
gotoAndStop(3);
}
}
id = setInterval(tellTime, 100);
[/AS]
Thanks!
PS: Sorry my english!