gregrampage
Programmer
I'm working on a countdown and everything is working until the final command to update the dynamic text field. I'm only having this problem in a file that uses onEnterFrame:
this.onEnterFrame = function () {
var todayate = new Date();
var currentTime = today.getTime();
var targetDateate = new Date(2007,5,22); //month is 0-11
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;
trace(counter);
this.time_txt.text = counter;
}
////end code
the final trace statement gives me the proper 00:00:00:00 values, but it doesn't update time_txt.
Any ideas?
Thanks!
Greg
this.onEnterFrame = function () {
var todayate = new Date();
var currentTime = today.getTime();
var targetDateate = new Date(2007,5,22); //month is 0-11
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;
trace(counter);
this.time_txt.text = counter;
}
////end code
the final trace statement gives me the proper 00:00:00:00 values, but it doesn't update time_txt.
Any ideas?
Thanks!
Greg