• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 28. Date Conversions > Displaying the Current Date

Displaying the Current Date

Your next task will be to initialize the Today field, which is cast member 10, with the current date.

Select cast member 1, which is currently an empty cast member, and choose Window > Script to open the Script Editor (Windows Ctrl+0, Macintosh Command+0).

You will create a StartMovie handler, as discussed in Lesson 17, to initialize cast member 10, Today, with the current date.

Click in the Script window and enter the following:

on startMovie                              --Do every time the movie starts.
  member ("Today").text = the long date    --Place the date in the Today text field.


As you saw in the last task, the long date is a very readable version of the date: for example, "Saturday, November 14, 2000." The actual display depends on the date format and language settings of the user's computer, but it will likely be something similar.

The Lingo instruction

member ("Today").text = the long date

assigns the long date string to the text property of the field cast member Today. This changes the text of that field to the current date, so that when the movie starts, that field (which appears on the stage as a sprite) will display the current date to the user. You can see that happen now by closing the Script Editor and rerunning the movie.

Close the Script Editor (Windows Ctrl+0, Macintosh Command+0) and play the movie again. Then stop the movie.

The movie starts, and the current date appears in the Today field. You can see the date under the heading "Today's date." Every time your movie runs, this field will be updated with the current date.

Figure .

Unless you have looping turned on for your movie, you probably noticed that the movie stopped at the last frame of the movie, frame 28. You need a frame behavior to keep the movie paused at that frame.

In the behavior channel, double-click frame 28 to open the Script Editor and modify the default script as shown in bold:

on exitFrame me
  go to the frame

The movie now continually loops on frame 28.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint