I need to create a simple reverse countdown that only needs
the detail level of Months and Years. All of the tutorials I’ve
found online are for counting down smaller intervals of time, like
days, minutes, seconds, and milliseconds.
I’m not very experienced with the code needed for such a
timer, but essentially what I would like to have happen is:
1. The current Month and Year are displayed onscreen.
2. I click the mouse, and the Month and Year begin to count
BACKWARDS, as if going back in time, so the Year would go from
2007, to 2006, to 2005, etc, while the 12 months of the year would
count down in reverse to coincide with the Year.
3. When I click the mouse again, the countdown stops at
whatever month/year it happens to be, I assume all the way back to
the Year 0 if I let it play to the end.
BONUS points if this reverse countdown could speed up over
time, so that it appears to begin slowly, and rapidly speed up as
the timer goes further back in time.
Note that I do not need to use the ACTUAL date taken from the
computer’s clock, I’d be happy to just enter in, say “June 2007″ as
the start date and have it reverse from there. So even something
that would just countdown from the numeral “2007″ to “0″ while a
movieclip of the 12 months cycling along could work, though I have
no concept as to how to control/increase the speed of such an
animation as it plays.|||
put the months in an array “december” to “january”, and set a
variable equal to the start year and an index that corresponds to
the start month. display the start year/month.
start a loop (setTimout would work) with a variable call
frequency that calls a function that
1. increases your array index (decreasing the year and
restarting your index at 0 after the last array element is
displayed) and displays the updated month/year
2. decreases the variable call frequency and define another
setTimeout.|||
Thanks for the advice. I’ve never used arrays or variables
(I’m apparently not an experienced ActionScripter
) but I will
poke around with the syntax and see what I can come up with.
|||
you’re welcome.
Related posts:
- Javascript countdown code
- Flash Countdown Clock in Specific Time Zone?
- Why does setting date to “year only” affect version set behavior (V9)?
- Leap year bug
- Line charts: Show Values in Reverse Order
Related posts brought to you by Yet Another Related Posts Plugin.