INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- Turn Off Ad Banners
- One-Click Access To Your
Favorite Forums
- Automated Signatures
On Your Posts
- Best Of All, It's Free!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Member Feedback
"...It is good to know that there are groups such as this willing to share knowledge in this money driven economy..."
Geography
Where in the world do Tek-Tips members come from?
|
countdown timer
|
|
|
AP81 (Programmer) |
7 Feb 05 20:16 |
Hi, I am a flash newbie (Programming background - Delphi, VB.NET, ASP) and need some direction with a countdown timer. I am trying to make a countdown timer based on a date and time. I want it to show days,hours,minutes,seconds like the one on this page http://www.flashloaded.com/flashtimer.php. I have found some examples, however most do not enable me to enter the start time/date. Any help,pointers or websites will be a great help. Thanks in advance.
------------------------------------ There's no place like 127.0.0.1 ------------------------------------
|
|
this is not great coding but something i saved a long time ago....no idea who wrote the code.....can be greatly improved upon CODESay you want to count down till new year 2006.....
Make a text field and give it variable name "timeRemaining" Place it in movie clip and paste the following action to this clip. right click on clip - Actions :
onClipEvent (enterFrame) { now = new Date(); NEW_YEAR = new Date(2006, 0, 0, 23, 59, 59); days = (NEW_YEAR-now)/1000/60/60/24; daysRound = Math.floor(days); hours = (NEW_YEAR-now)/1000/60/60-(24*daysRound); hoursRound = Math.floor(hours); minutes = (NEW_YEAR-now)/1000/60-(24*60*daysRound)-(60*hoursRound); minutesRound = Math.floor(minutes); seconds = (NEW_YEAR-now)/1000-(24*60*60*daysRound)-(60*60*hoursRound)-(60*minutesRound); secondsRound = Math.round(seconds); if (secondsRound == 1) {sec = " second ";} else {sec = " seconds ";
}
if (minutesRound == 1) {min = " minute ";} else {min = " minutes ";
}
if (hoursRound == 1) {hr = " hour ";} else {hr = " hours ";
}
if (daysRound == 1) {dy = " day ";} else {dy = " days ";
}
timeRemaining = daysRound+dy+hoursRound+hr+minutesRound+min+secondsRound+sec;
} |
|
|
AP81 (Programmer) |
7 Feb 05 22:40 |
Thanks for your help but I am getting some script errors. Will keep trying.
------------------------------------ There's no place like 127.0.0.1 ------------------------------------
|
|
|
AP81 (Programmer) |
8 Feb 05 0:35 |
Got it working, thanks mate.
------------------------------------ There's no place like 127.0.0.1 ------------------------------------
|
|
yip just checked it myself.....couple of unwanted - signs in there....works fine with those removed....still a poor piece of code though |
|
|
 |
|