-
Countdown timer
Hi,
Im a total newbie, and I've been asked to make a flash countdown timer.
I want to use a dynamic text field to display the numbers, but have a few buttons that go with them.
I want to be able to press the button, and a set time is generated in the dynamic txt field, i.e. 10 minutes, 15 minutes & 30 minutes.
The idea is that the user will press 30 minutes, then start, then the countdown will commence, and same for the other time increments.
Can anyone help?
I've trawled the net, and just cannot find the tutorial
Cheers
Eddie
-
please can anyone help me
-
Prid - Outing
This is based on another code of mine. Simply make a Dynamic Textfield with the Variable Name of, timer, make two buttons with instance names, start_btn and stop_btn, and use this code on your Frame and adjust the settings as desired:
Actionscript Code:
// SETTINGS // minutes = 30; seconds = 0; /////////////
min2 = minutes; sec2 = seconds;
function displayTimer(){ if(_root.seconds == 0){ _root.seconds = 59; _root.minutes--; } else { _root.seconds--; } }
onEnterFrame = function(){ if(_root.seconds < 10){ new_sec = "0"+_root.seconds; } else { new_sec = _root.seconds; } if(_root.minutes < 10){ new_min = "0"+_root.minutes; } else { new_min = _root.minutes; } if(new_min <= 0 && new_sec <= 0){ _root.timer = "Completed!"; clearInterval(myTimer); } else { _root.timer = new_min+":"+new_sec; } }
start_btn.onPress = function(){ clearInterval(myTimer); myTimer = setInterval(displayTimer, 1000); }
stop_btn.onPress = function(){ clearInterval(myTimer); minutes = min2; seconds = sec2; }
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
Nig_13, you are fantastic! thank you so much.
May I ask how you learned to write flash code?
Im very interested in learning
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|