Timer that counts up & down to set events

Hi there,
I am at my wits end trying to figure this one out.
i am a complete beginner to AS3 and need to complete my first assignment.

I have to create a program that will react in a certain way depending on what day/time it is.
For instance, I have a lesson on Monday at 13:00 and need the program to act in this way :

If I run the program before the lesson, it will display a relevant picture, a message and a countdown timer to the lesson time.
If run after the lesson, it will display a relevant picture, a message and a timer of time elapsed since the lesson started.

I have managed the picture/message parts bit not the displayed timer!
I understand this is the timer function but cannot find a way to do this that I understand!
I have searched countless tutorials and am still stumped!!!

Can anyone help?

Negatory. This is not the timer function. You want to stick with date, which is what I assume you’re using for the picture bit.

You use date to get: 1) the current date right now, and 2) the date of the lesson time (getTime()). Then you get the difference and you have the date between the two times. The difference, if negative or not, will tell you if you’re before or after the date. And the actual (abs) value will give you your timer time. You just need to divide that up into days, hours, minutes, etc. Any time you update the timer (which is fine in an enterFrame event) you can recapture the current date, make the difference again, and update the days, hours, minutes, etc again.

1 Like

Thanks, Took your advice and am having some success.
Just a few more probls to solve now! :slight_smile: