Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Working with Dates in Flash docx
Nội dung xem thử
Mô tả chi tiết
< Day Day Up >
Working with Dates in Flash
It's useful in Flash to be able to access date information—to display the date, make a
movie do specific things on certain dates, create countdown timers, or display the day of
the week for a particular date in history, to name just a few examples.
To use dates in Flash, you create an instance of the Date class by using the following
syntax:
var myDate:Date = new Date(year, month, date);
This syntax creates a new Date object named myDate. The parameters in parentheses
associate the Date object with a specific date. For example:
var myDate:Date = new Date(66, 6, 27);
This example creates a Date object associated with July 27, 1966. The first parameter
represents the year, the second represents the month, and the third represents the date.
You may wonder why July, which we consider the seventh month in the year, is actually
defined as the sixth month in the script above. In ActionScript, both months and days of
the week are referenced by numbers, beginning with 0; therefore, January is the "zero"
month, February is the first month, March is the second month, and so on—up to
December, which is the eleventh month. Likewise, days of the week begin with Sunday
as the "zero" day, Monday the first day, and so on. The following exercise demonstrates
the usefulness of this numbering system.