Hi,
I have downloaded one countdown counter which is quite nice. But instead of entering the event schedule in the source file, how can I retrieve the date (day, month & year) from an external xml file. Because I need to change very often the schedule date.
How can I modify the below code to get work done?
stop();
var year:Number = 2014;
var month:Number = 2;
var day : Number = 1;
var finalDate:Date = new Date(year,month-1,day);
var timer:Timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, updateTime);
timer.start();
function updateTime(e:TimerEvent):void{
var now:Date = new Date();
var remainTime:Number = finalDate.getTime() - now.getTime();
if (remainTime >0) {
var secs:Number = Math.floor(remainTime/1000);
var mins:Number = Math.floor(secs/60);
var hours:Number = Math.floor(mins/60);
var days:Number = Math.floor(hours/24);
var secsText:String = (secs%60).toString();
var minsText:String = (mins%60).toString();
var hoursText:String = (hours%24).toString();
var daysText:String = days.toString();
if (secsText.length < 2) {secsText = "0" + secsText;}
if (minsText.length < 2) {minsText = "0" + minsText;}
if (hoursText.length < 2) {hoursText = "0" + hoursText;}
if (daysText.length < 2) {daysText = "0" + daysText;}
day_txt.text = daysText;
hour_txt.text = hoursText;
min_txt.text = minsText;
sec_txt.text = secsText;
}
else {
timer.removeEventListener(TimerEvent.TIMER, updateTime);
timer.stop();
gotoAndStop(2);
}
}
Thanks for any help.