I'm not familiar with Senocular's tutorial, but I'm guess you can do this relatively easily.
The Date object is key. Create a new Date like this:
Code:
var currentDate:Date = new Date();
And you have the current date and time stored in a var called currentDate. Keep in mind that this is a "snapshot" of a
a date and time, not a continually updating "currentDate."
Now, you can create another new Date like this:
Code:
var otherDate:Date = new Date(2006, 4, 20, 17, 0, 0, 0);
And you have a "snapshot" of the date/time of 5:00 PM on Friday, May 20, 2006.
With these two dates, you can get the difference between hours, days, whatever, and probably work out your countdown from there. The idea would be to store the destination time in a variable, and continually get a new Date() every time you need to update the countdown timer.
The trick, however, is getting the
next Friday, and not a hard coded one.
The following create a new Date, set to the current date, and then increments it by one day until it's Friday:
Code:
// Create a date to be Friday, but start out as the current date.
var fri:Date = new Date();
// use getDay() to see if it's 5 (friday). If not, add on to the
// date (e.g. May 15 becomes May 16).
while (fri.getDay() != 5) {
trace(fri);
fri.setDate(fri.getDate()+1);
}
// Set the Time to 5:00:00:000 PM
fri.setHours(17);
fri.setMinutes(0);
fri.setSeconds(0);
fri.setMilliseconds(0);
trace(fri);
I put some traces in there so you can see the date advance itself. At the end of this code block, the var fri holds a timestamp of the next Friday, 5:00 PM. Can you take it from there?