How to Make a Timer in Flash

By David Weedmark

Using Adobe Flash you can create an ActionScript 2.0 timer to add to a game or presentation file, or to use by itself on a website to show visitors how long they have been on a page. You can use Adobe Flash CS5.5 to write with Actionscript 2.0 or 3.0. However it's important to note that Actioscript 2.0 uses different rules than ActionScript 3.0 — and the two are not compatible with each other.

Step 1

Launch Adobe Flash and create a new ActionScript 2.0 file by selecting "New" from the File menu.

Step 2

Add a second layer by selecting "Timeline" from the Insert menu and clicking "Layer." Click the "Timeline" tab and select "Layer 1."

Step 3

Click the "Tools" tab and select the "Text Tool." Drag the tool across the canvas to create a text box.

Step 4

Click the "Properties" panel. Select "Dynamic Text" in the Text menu. Format the text as desired in the Character section of the Properties panel. Type "timer" in the "Variable" field located in the Options section of the panel.

Step 5

Click the "Timeline" tab and click "Layer 2" to select it. Click the "Actions-Frame" tab. Copy and paste this code into the Actions-Frame text field:timer = 0;countup = function(){
}countupInterval = setInterval(countup,1000);

Step 6

Select "Publish Preview" from the File menu, then click "Flash" to preview the timer. The timer begins at zero and counts up until the window is closed.