Hi,
just want to know if some one can help me with my countdown timer.
every time it counts down and gets to zero it goes back to 59:59:59:59.
i need it to stay at 00:00:00:00 or even better make the 00:00:00:00 it flash.
[FONT=Tahoma]// first get this current year so this example[/FONT]
[FONT=Tahoma]// remains valid for some time to come[/FONT]
[FONT=Tahoma]var thisYear:Number = 2011;[/FONT]
[FONT=Tahoma]var thisDay:Number = 28;[/FONT]
[FONT=Tahoma]var thisMonth:Number = 2;[/FONT]
[FONT=Tahoma]var thisHours:Number = 19;[/FONT]
[FONT=Tahoma]var thisMin:Number = 30;[/FONT]
[FONT=Tahoma]var thisSec:Number = 0;[/FONT]
[FONT=Tahoma]var countdownXML:XML = new XML();[/FONT]
[FONT=Tahoma]countdownXML.ignoreWhite = true;[/FONT]
[FONT=Tahoma]countdownXML.load( 'countdown.xml' );[/FONT]
[FONT=Tahoma]countdownXML.onLoad = function( success:Boolean ):Void[/FONT]
[FONT=Tahoma]{ [/FONT]
[FONT=Tahoma]var nowDate:Date = new Date();[/FONT]
[FONT=Tahoma]if( success ) {[/FONT]
[FONT=Tahoma] var eventDateData = countdownXML.childNodes[0].childNodes;[/FONT]
[FONT=Tahoma] if( eventDateData[0].attributes['year'] ) thisYear = Number( eventDateData[0].attributes['year'] );[/FONT]
[FONT=Tahoma] if( eventDateData[0].attributes['month'] ) thisMonth = Number( eventDateData[0].attributes['month'] );[/FONT]
[FONT=Tahoma] if( eventDateData[0].attributes['day'] ) thisDay = Number( eventDateData[0].attributes['day'] );[/FONT]
[FONT=Tahoma] if( eventDateData[0].attributes['hours'] ) thisHours = Number( eventDateData[0].attributes['hours'] );[/FONT]
[FONT=Tahoma] if( eventDateData[0].attributes['minutes'] ) thisMin = Number( eventDateData[0].attributes['minutes'] );[/FONT]
[FONT=Tahoma] if( eventDateData[0].attributes['seconds'] ) thisSec = Number( eventDateData[0].attributes['seconds'] );[/FONT]
[FONT=Tahoma] var testEventDate = new Date(thisYear, thisMonth-1, thisDay, thisHours, thisMin, thisSec );[/FONT]
[FONT=Tahoma] if( testEventDate <= nowDate ) {[/FONT]
[FONT=Tahoma] thisYear = nowDate.getUTCFullYear();[/FONT]
[FONT=Tahoma] thisDay = nowDate.getUTCDate() + Math.round( Math.random() );[/FONT]
[FONT=Tahoma] thisMonth = nowDate.getUTCMonth();[/FONT]
[FONT=Tahoma] thisHours = nowDate.getHours();[/FONT]
[FONT=Tahoma] thisMin = nowDate.getMinutes();[/FONT]
[FONT=Tahoma] thisSec = nowDate.getSeconds();[/FONT]
[FONT=Tahoma] }[/FONT]
[FONT=Tahoma]} else {[/FONT]
[FONT=Tahoma] thisYear = nowDate.getUTCFullYear();[/FONT]
[FONT=Tahoma] thisDay = nowDate.getUTCDate();[/FONT]
[FONT=Tahoma] thisMonth = nowDate.getUTCMonth();[/FONT]
[FONT=Tahoma] thisHours = nowDate.getHours();[/FONT]
[FONT=Tahoma] thisMin = nowDate.getMinutes();[/FONT]
[FONT=Tahoma] thisSec = nowDate.getSeconds();[/FONT]
[FONT=Tahoma]}[/FONT]
[FONT=Tahoma]startCountdown();[/FONT]
[FONT=Tahoma]}[/FONT]
[FONT=Tahoma]function startCountdown():Void[/FONT]
[FONT=Tahoma]{[/FONT]
[FONT=Tahoma]eventDate = new Date(thisYear, thisMonth-1, thisDay, thisHours, thisMin, thisSec );[/FONT]
[FONT=Tahoma]this.onEnterFrame = update;[/FONT]
[FONT=Tahoma]}[/FONT]
[FONT=Tahoma]function update():Void[/FONT]
[FONT=Tahoma]{[/FONT]
[FONT=Tahoma]//Current time[/FONT]
[FONT=Tahoma]var now:Date = new Date();[/FONT]
[FONT=Tahoma]var timeLeft:Number = eventDate.getTime() - now.getTime();[/FONT]
[FONT=Tahoma]//Converting the remaining time into seconds, minutes, hours, and days[/FONT]
[FONT=Tahoma]var seconds:Number = Math.floor(timeLeft / 1000);[/FONT]
[FONT=Tahoma]var minutes:Number = Math.floor(seconds / 60);[/FONT]
[FONT=Tahoma]var hours:Number = Math.floor(minutes / 60);[/FONT]
[FONT=Tahoma]var days:Number = Math.floor(hours / 24);[/FONT]
[FONT=Tahoma]//Storing the remainder of this division problem[/FONT]
[FONT=Tahoma]seconds %= 60;[/FONT]
[FONT=Tahoma]minutes %= 60;[/FONT]
[FONT=Tahoma]hours %= 24;[/FONT]
[FONT=Tahoma]updateCounters( days, hours, minutes, seconds );[/FONT]
[FONT=Tahoma]}[/FONT]
[FONT=Tahoma]function updateCounters( numDays, numHours, numMin, numSec ):Void[/FONT]
[FONT=Tahoma]{[/FONT]
[FONT=Tahoma]days.gotoAndPlay( 'to' + numDays );[/FONT]
[FONT=Tahoma]hours.gotoAndPlay( 'to' + numHours );[/FONT]
[FONT=Tahoma]min.gotoAndPlay( 'to' + numMin );[/FONT]
[FONT=Tahoma]sec.gotoAndPlay( 'to' + numSec );[/FONT]
[FONT=Tahoma]}[/FONT]
I would be happy to try anything to get this to work as i have been trying to fix this problem for a while with no luck.
Regards,
Adam