I used sen’s most all mighty powerful Date Countdown tutorial. Everything works perfect. :thumb:
I would be planning on using this for a release of a site type of thing where when it hits the exact time it will go to the site page, which I want to stay hidden. But I don’t want users to be able to change their system clock to make the countdown end. How can I get around that security problem and have it run off of the server clock or something of the sort?
The answer is simple… mostly… kind of… in a way… ok maybe not really ;). Basically, with the countdown tutorial, you start the countdown with an initial retrieval of the event date using the date object. This gives you a milliseconds count that is representational of that point in time. The countdown is then run off of a comparison of the current time in respect to that event time. The current time is calculated repeatedly based on the date object retrieved in Flash for the current time as specified by the users clock. And its that where your problem lays… so what you’ll need to do, as you’ve figured out, is to get the ‘real’ date, or at least the date as you see it, from your server and use that for the comparison. The event date, by the way, will not be server based since its always the same no matter what the current time or date settings are for your system.
Does this mean that you would need to constantly get an updated date from the server and relay that information to Flash over a stream which can be continuously compared to the event date with Flash? No. All you need is one initial reference of the ‘real’ time to be used in Flash. Once recieved, Flash can then use its getTimer() function (which is date independant) to keep track of the change milliseconds and append that to the server time every frame from which the comparison to the event time can be made.
So to recap:
[list][]Get event date in Flash
[]Get ‘real’ time from server
[]Everyframe add to the ‘real’ time the change in milliseconds from when it was first recieved using getTimer()
[]With that new ‘real’ time + change in time, you have the real time as the server would see it, which can then be compared with the event time and a counter created.[/list]