I’ve found a few tutorials on the web, but none of them have really worked for me. I know this is probably a really simple thing to do, but I just can’t figure it out. So I’ve come to the all-mighty kirupa forum for guidance.
Basically all I want is a 30 minute timer that counts down to zero, displaying the minutes and seconds as it counts down. When the timer reaches zero I want the movie to go to a specific frame label.
or on a 3-frame loop like this:
on the first frame:
deadline = getTimer()+30000;
on the second frame:
countdown = (deadline-getTimer);
mytextbox = countdown*1000;
if(countdown<0) {
<do something if the countdown reaches 0>
}
on the third frame:
gotoAndPlay(2);
-.-------.-
deadline = getTimer()+30000; <- this little piece of code calculates the deadline (the time when the countdown reaches 0)
30minutes multiplied by 1000 is 30000 cuz it’s in milliseconds
[SIZE=1]note: getTimer() returns the number of seconds that have elapsed since the movie was started not starts a timer[/SIZE] countdown = (deadline-getTimer); <-calculates how much time to deadline!
mytextbox = countdown*1000;[SIZE=1]optional[/SIZE] <- if you want creat a textbox give it a variable name and change “mytextbox” to the variable name of the textbox and the minutes left will be displayed there!
if(countdown<0) {
<do something if the countdown reaches 0>
}
if the countdown reaches zero the bomb explodes! just replace “<do something…bla bla bla>” with the actions you want it to trigger if the countdown reaches zero!
thanks, I noticed that thread right after I started mine. it looks like you’ve figured out what i’m trying to do though. mine is really basic, just a countdown timer and when it reaches zero i want the movie to jump to a label. any help?
DOH’ DJ! I always do it the hardest way!
well rhombus the code DJ gave you the actions for this would be like this:
if(display.text == 30) {
_root.yourmovieclip.gotoAndStop(“yourlabel”);
}
replace yourmovieclip with the movieclip you want!
also note that the counter counts up like 1, 2, ,3 not 3,2,1,0
change ++myTimer to --myTimer!
or you can do it with variables but hey…doesn’t matter!