LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-16-2011, 09:11 PM
adz_aus adz_aus is offline
Registered User
 
Join Date: Mar 2011
Location: Australia
Posts: 3
Rep Power: 0
adz_aus is on a distinguished road
Countdown Timer

Hi,

just want to know if some one can help me with my countdown timer.

every time it my countdown timer 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 it flash.

Code:
var thisYear:Number = 2011;
var thisDay:Number = 28;
var thisMonth:Number = 2;
var thisHours:Number = 19;
var thisMin:Number = 30;
var thisSec:Number = 0;
var countdownXML:XML = new XML();
countdownXML.ignoreWhite = true;
countdownXML.load( 'countdown.xml' );
countdownXML.onLoad = function( success:Boolean ):Void
{  
 var nowDate:Date = new Date();
 if( success ) {
     var eventDateData = countdownXML.childNodes[0].childNodes;
  if( eventDateData[0].attributes['year'] ) thisYear = Number( eventDateData[0].attributes['year'] );
  if( eventDateData[0].attributes['month'] ) thisMonth = Number( eventDateData[0].attributes['month'] );
  if( eventDateData[0].attributes['day'] ) thisDay = Number( eventDateData[0].attributes['day'] );
  if( eventDateData[0].attributes['hours'] ) thisHours = Number( eventDateData[0].attributes['hours'] );
  if( eventDateData[0].attributes['minutes'] ) thisMin = Number( eventDateData[0].attributes['minutes'] );
  if( eventDateData[0].attributes['seconds'] ) thisSec = Number( eventDateData[0].attributes['seconds'] );
  
  var testEventDate = new Date(thisYear, thisMonth-1, thisDay, thisHours, thisMin, thisSec );
  if( testEventDate <= nowDate ) {
   thisYear = nowDate.getUTCFullYear();
   thisDay = nowDate.getUTCDate() + Math.round( Math.random() );
   thisMonth = nowDate.getUTCMonth();
   thisHours = nowDate.getHours();
   thisMin = nowDate.getMinutes();
   thisSec = nowDate.getSeconds();
  }
 } else {
  thisYear = nowDate.getUTCFullYear();
  thisDay = nowDate.getUTCDate();
  thisMonth = nowDate.getUTCMonth();
  thisHours = nowDate.getHours();
  thisMin = nowDate.getMinutes();
  thisSec = nowDate.getSeconds();
 }
 startCountdown();
}
function startCountdown():Void
{
 eventDate = new Date(thisYear, thisMonth-1, thisDay, thisHours, thisMin, thisSec );
 this.onEnterFrame = update;
}
function update():Void
{
 //Current time
 var now:Date = new Date();
 var timeLeft:Number = eventDate.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;
 updateCounters( days, hours, minutes, seconds );
}
function updateCounters( numDays, numHours, numMin, numSec ):Void
{
 days.gotoAndPlay( 'to' + numDays );
 hours.gotoAndPlay( 'to' + numHours );
 min.gotoAndPlay( 'to' + numMin );
 sec.gotoAndPlay( 'to' + numSec );
}
if some could help that would be great.

Regards,

Adam
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Countdown Timer adz_aus Newbies 2 03-18-2011 07:36 PM
Countdown Timer help adiboy Flash MX ActionScript 6 08-01-2007 07:47 PM
Something like a countdown timer datrademarc Actionscript 2.0 0 11-11-2006 07:29 AM
Actionscript countdown timer boing_5000 Flash MX ActionScript 0 04-28-2004 01:41 PM
Countdown Timer integra Flash MX ActionScript 7 04-16-2004 09:45 PM




All times are GMT. The time now is 04:57 AM.