Flash Tutorial Displaying Frame Numbers
July 4, 2008 3:07 pm UncategorizedCourtesy of WebWasp.co.uk Tutorials
The aim of the tutorial is to learn how to use actionscript to display the Frame number from the Timeline.
Example: Download the Flash file Beg 017a
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
- With the Arrow Tool
go to frame 50 in the time line and right click (Mac: Ctrl click) and select: Insert Frame

The time line with 50 frames.
Note: Remember that you can change the frame rate at any time.
Courtesy of WebWasp.co.uk Tutorials
Courtesy of WebWasp.co.uk Tutorials
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.
Courtesy of WebWasp.co.uk Tutorials
Courtesy of WebWasp.co.uk Tutorials
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: Download the Flash file Beg 017b
Example of frame number being taken from the Timeline inside a Movie Clip.
