1. Create a static text box with the words time: in black on your stage.
2. Created a dynamic text box next to it with black text, centered, and
with var = time
3. Rename your layer to text. Lock it. Insert a layer and rename it
actions.
4. Click In frame 1 of your actions layer. Open your actions palette. On
the toolbox on the left, select actions=> Variables=> Set Variables.
4. In the actions parameters set the variable as time, the same as the
var in the dynamic text box. Click in the value field and find in the action
toolbox functions=> getTimer. Check expression. GetTimer script will display the time in
1000ths of a second since the movie started.
5. Test movie by clicking Control=> Test Movie. Here you will only see
one value for time elapsed. This is because your movie is only one frame and
a single frame movie does not loop. We need to extend the timeline so the
movie will loop and revisit the set variable script to update your time.
6. Clicked on top of the layers palette right on the playhead and hit F5
to extend your layers out to frame 2.
7. Test your movie. Now your dynamic text box will show thousandths of
seconds. This is why it updates so fast. We will need to change this time to
seconds in the next step.
8. Click in frame 1 of the actions layer and open your actions panel
again. Where the value says GetTimer(), add /1000 to divide by 1000, so that
we convert the value to the unit of seconds.
9. Test your movie. Your dynamic test box will display the time in
seconds, and include a decimal after it. If you want whole numbers you will
need to round this value in the next step.
10. We have three methods for rounding. Ceil will round up, floor will
round down, and round will round up if over .5 and down if under .5. In this
case we want the time to register 1 after the movie has been open for 1
second so we need to round using floor, or down.
In your value field, copy the statement getTimer()/1000 by highlighting,
right clicking and selecting copy. Then delete the script in the value
field. Open your action script tool box and select objects=> core=> math=>
methods=> Floor so the script ends up in the value box. This will round down
whatever is in the parenthesis. Click inside the parentheses in the value
box, and right click and paste the getTimer()/1000 script so that the
resulting script is