Click to See Complete Forum and Search --> : flash countdown problem


Xpandemic
10-03-2009, 01:52 PM
Hey guys, I created a flash countdown timer for the release of Borderlands which can be viewed here: Linky (http://www.haloportal.net/border/) My problem is the timer moves and I want to to stay stationary, How can I fix this?

//Create your Date() object
var endDate:Date = new Date(2008,7,20);
//Create your Timer object
//The time being set with milliseconds(1000 milliseconds = 1 second)
var countdownTimer:Timer = new Timer(1000);
//Adding an event listener to the timer object
countdownTimer.addEventListener(TimerEvent.TIMER, updateTime);
//Initializing timer object
countdownTimer.start();
//Calculate the time remaining as it is being updated
function updateTime(e:TimerEvent):void
{
//Current time
var now:Date = new Date();
var timeLeft:Number = endDate.getTime() - now.getTime();
//Converting the remaining time into seconds, minutes, hours, and days
var seconds:Number = Math.floor(timeLeft / 1000);
var minutes:Number = Math.floor(seconds / 60);
var hours:Number = Math.floor(minutes / 60);
var days:Number = Math.floor(hours / 24);

//Storing the remainder of this division problem
seconds %= 60;
minutes %= 60;
hours %= 24;

//Converting numerical values into strings so that
//we string all of these numbers together for the display
var sec:String = seconds.toString();
var min:String = minutes.toString();
var hrs:String = hours.toString();
var d:String = days.toString();

//Setting up a few restrictions for when the current time reaches a single digit
if (sec.length < 2) {
sec = "0" + sec;
}

if (min.length < 2) {
min = "0" + min;
}

if (hrs.length < 2) {
hrs = "0" + hrs;
}

//Stringing all of the numbers together for the display
var time:String = d + ":" + hrs + ":" + min + ":" + sec;
//Setting the string to the display
time_txt.text = time;
}

tedscoffee
10-08-2009, 06:50 PM
Are you able to post a link so we can see what the problem is?

I used this flash count down clock (http://www.a4flash.com/lib/access/countdown/) for a website we were launching and it worked well. Maybe you can use it as a reference too.

Xpandemic
10-08-2009, 07:05 PM
I did post a link, here it is again http://www.haloportal.net/border

criterion9
10-08-2009, 07:32 PM
You'll need to use a font that doesn't have variations in width between numbers. Alternatively you could try aligning your textfield to center and see if that helps a bit.