countdown
//Minute countdowner (Minutnedräknaren)//By Kenneth Andersson aka Kenzilla, 2006.
//Use it however you like.
//
//First we need a dynamic textfield with instance name "theText", check.
//Then we set the total number of minutes. I picked 64 to reduce the
//result-view-waiting-time. 119 would just be... boring.
total = 900;
//Calculate the var total and update the textfield.
this.onEnterFrame = function() {
minutes = Math.floor(total/60);
seconds = total%60;
if (seconds<=9 && minutes<=9) {
theText.text = "0"+minutes+":"+"0"+seconds;
} else if (seconds<=9) {
theText.text = minutes+":"+"0"+seconds;
} else if (minutes<=9) {
theText.text = "0"+minutes+":"+seconds;
} else {
theText.text = minutes+":"+seconds;
Hej eksperter
hvorfor kan jeg ikke få den her til at virke i flah 4
}
};
//Function for the countdown, can be changed to total++ if you want to
//count "into the future" or something. Well I dunno.
//clearInterval = When minutes and seconds is 00:00 it stops.
counter = function () {
total--;
if (minutes == 0 & seconds == 1) {
clearInterval(setIt);
}
};
//Then we start an interval with the counter function, 1000 is milliseconds á 1 sec.
setIt = setInterval(this, "counter", 1000);
