INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

HANDLE


PASSWORD
Remember Me
Forgot Password?

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!

E-mail*
Handle

Password
Verify P'word
*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
Partner Button
(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?
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
------------------------------------

Check Out Our Whitepaper Library. Click Here.
Helpful Member!billwatson (Instructor)
7 Feb 05 21:43
this is not great coding but something i saved a long time ago....no idea who wrote the code.....can be greatly improved upon

CODE

Say 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
------------------------------------

Helpful Member!billwatson (Instructor)
8 Feb 05 17:08
yip  just checked it myself.....couple of unwanted - signs in there....works fine with those removed....still a poor piece of code though
Helpful Member!billwatson (Instructor)
8 Feb 05 20:23

Start A New Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Promoting, selling, recruiting and student posting
are not allowed in the forums.
Posting Policies

LINK TO THIS FORUM!
(Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum)
TITLE: Adobe(Macromedia): Flash Forum at Tek-Tips
URL: http://www.tek-tips.com/threadminder.cfm?pid=250
DESCRIPTION: Adobe(Macromedia): Flash technical support forum and mutual help system for computer professionals. Selling and recruiting forbidden.