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;
}