The aim of the tutorial is to learn how to use actionscript to display the frame number.
Example of frame number being displayed.
Step one: Document setup
The number of frames per second is controlled by the default setup. You cannot have one part of a movie playing at 12 frames pre second and another playing at 8 frames per second. To change the default setup:
- Go to: Modify > Document
- You will see: Frame rate: 12 fps
or something similar. The movie above is set at: 12 fps (frames per second) - If you wish change the setting. This will slow down or speed up the play rate of your movie.
- Click: OK
Note: Remember that you can change the frame rate at any time.
- With the Arrow Tool
go to frame 50 in the time line and right click (Mac: Ctrl click) and select: Insert Frame
Step two: Display text box
You need a text box on stage so that the number can be displayed.
- With the text tool selected, drag on stage to create an empty text box.
- If the Property panel is closed, open it: Window > Properties
- In the drop down menu select: Dynamic Text
- For Variable name type: displayNumber
Do not get confused with instance name. If you type the name in the wrong box it will not work!
- In the Property panel select a Font and Font colour.
Tip: As soon as you have finished with the Text tool
always go straight back to the Arrow tool
. This stops you typing on stage by mistake.
Step three: ActionScript
- Right click on frame one and select: Actions
- The Actions panel go to the View Options button
and select: Expert Mode - Type the following code:
onEnterFrame=function(){
_root.displayNumber=_root._currentframe;
}
- Test your movie. To do this go to: Control > Test Movie
Your movie should display the current frame number.
Note: If you do not want to display the frame number of the main time line but the frame number of a movie clip, give the movie clip an instance name and change the second line of script to:
| _root.displayNumber=_root.myInstanceName._currentframe; |
Example of frame number being taken from Movie Clip

10 Random Flash Tutorials :
10 Random FlashPerfection.com Tutorials:











