You want to know the current date and time.
Create a new date
Date( ) constructor
with no parameters. Alternatively, use a CGI script or any other
server-side language to return the server time, and create a new
Date object from that value.
The date and time that ActionScript can calculate on its own is based
on the client computer’s date and time settings.
Therefore, if the user’s computer has the incorrect
time, so will the Flash movie. With that caveat in mind, you can
retrieve the current client-side date and time by creating a new
Date object using the
) constructor with no parameters, as follows:
// Create a new
Dateobject. today = new Date( ); // Displays client-side date and time trace(today);
Avoid the temptation
name your date variable
identifiers (including variable and class names) are
Date is the name of the
constructor function for the
therefore, naming a variable
date disables the
If an active Internet connection is available, the Flash movie can try to retrieve the date and time from a server. This technique can ensure more accurate dates and times. Although the server’s time settings might be inaccurate, at least the time will be consistent for all client movies.
The basic process when reading the time from a server is as follows:
Create a CGI script on the web server that outputs a name/value ...