[SIZE=2]Hello. I used to come to Kirupa before O.o but never realized it had a forum. The thing is: I need help adding “milisseconds” to a countdown where I currently have “days”, “hours”, “minutes” and “seconds”. The intention here is to remove the “days” and add “milisseconds”. I got the (flawed) code from a tutorial, fixed it here and there, and somehow it works now, but I am a newcomer to Flash and I understand absolutely nothing of ActionScript, so adding the milisseconds is way beyond what I can do now >_<.
Here’s the code:
[/SIZE]
[SIZE=2]this.onEnterFrame = function() {
var today:Date = new Date();
var currentYear = today.getFullYear();
var currentTime = today.getTime();
var targetDate:Date = new Date(currentYear,5,1);
var targetTime = targetDate.getTime();
var timeLeft = targetTime - currentTime;
var sec = Math.floor (timeLeft/1000);
var min = Math.floor (sec/60);
var hrs = Math.floor (min/60);
var days = Math.floor (hrs/24);
sec = string(sec % 60);
if (sec.length < 2) {
sec = "0" + sec;
}
min = string(min % 60)
if (min.length < 2) {
min = "0" + min;
}
hrs = string(hrs % 24)
if (hrs.length < 2) {
hrs = "0" + hrs;
}
days = string(days);
var counter:String = days + ":" + hrs + ":" + min + ":" + sec;
countdown_txt.text = counter;
}
[/SIZE]
[SIZE=2]
[/SIZE] [SIZE=2]
[/SIZE]
[SIZE=2]
I really need help with this >_< and it is kind of urgent.
Thanks a LOT in advance to anyone who replies here, any help is appreciated.
[/SIZE]