Using the Timer and Date classes

There are several methods in ActionScript for dealing with time. We have shown before how to find a user's response time using the getTimer() method as we did in the enanced (final) version of the Arithmetic Quiz from the tutorial, "Using Textboxes in an Arithmetic Quiz" in our Basic section.

In the present tutorial, we will show how to use a Timer object to create animated motion or a simple repeated event. On a related note, there is a Date class that allows you to display the system time. We show how to combine this class with a Timer object to create a simple digital clock effect.

Downloads

The source file for the examples in this tutorial can be downloaded together in timers.zip. Each individual source file can be found on the page that explains that example.

Back to Basic Tutorials              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. Click the Contact Us link below and email one of us.

Adobe®, Flash®, ActionScript®, Flex® are registered trademarks of Adobe Systems Incorporated.