1.
Create a new movie.
2.Click anywhere on the movie stage and open your properties panel.. You
will need to make sure you are set to a frame rate of 12 fps (frames per
second) so the timing is correct in counting time. This means that your movie will progress at 12 frames each second.
click ok.
3.
Insert new layer by right clicking on layer one and selectiong insert layer.
Click on the name to activate the edit box and Name it Actions.
Rename Layer 1 to Counter.
4.
Select your text tool and click on frame 1 of counter. Click on your stage
to plant a text box. On the properties panel make sure it is totally open by
clicking the small carrot in the lower right corner of the properties panel.
Set the set box as follows:
- dynamic text
- Single line
- variable = time
5. Resize your text box on the stage to the size you want your text to
fill. On the character panel, select the size of font. On the paragraph
select the orientation of the text. In this example I set it to center the
text. (Any additional text must be in a separate text box as static text.)
6. Click on the layer counter frame 13 and hit F5 to extend out to that
frame.
7. Insert a keyframe on the actions layer frame 2 by clicking in frame 2
of the actions layer and hitting the F6 key. Highlight frame 1 of the
actions layer and Open your action
panel.
8. Setting up a variable: Click + => actions => variables=> set variable.
Type in the following:
- variable name is Time
- the value is 0
- check expression box.
So the action in frame 1 looks like this: time = 0;
9. Click on frame 13 on the actions layer
and hit F6 to
insert keyframe. What we will do on frame thirteen is set an action that
will increment the variable time by 1 every twelve frames.
On the actions panel click the right and arrow and select expert mode
which allows up to type in any command that is not listed as we want it in
the presets.
Type in the Following: time ++;
This will increase time by a value of 1 each time this frame is played. (if
you were starting with a high number and wanted to count down by one you
might type in: time -- ;)
Check your syntax by clicking the right hand arrow on the actions panel
and select Check syntax. When you see that you have typed it in correctly,
return to normal mode by clicking the right arrow and select normal mode.
10. After you have added the increment on the 13th frame you will need to
tell flash to replay the loop of 12 frames. While your still on frame 13
select + => basic actions => goto. Then select the frame number 2.
This
sends the movie back to play frame number 2-13, or 12 frames before it
increases time by a value of 1. Remember 12 frames is a second on a movie
that is 12fps. 16 frames would be a second on a movie that is 16 fps.
Your resulting script on frame 13 should look like this:
time++;
gotoAndPlay (2)
And
your movie timeline should look like this:
You might ask why we do not send the movie back to frame 1. This is
because it would reset the value of time to 0, since frame 1 has the action
script time=0; in it.
You should be able to count time now. If you build this movie in a movie
clip, you have an automatic timer in seconds you can use in any movie.
|