Displaying Frame Numbers

Home Food Mates • Members Tutorials Forum Buy Templates Contact Us 

 


Flash Tutorials

   

Flash Tutorial - Displaying Frame Numbers

 

Free Flash Tutorial

 

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:

  1. Go to: Modify > Document
  2. You will see: Frame rate: 12 fps
    or something similar. The movie above is set at: 12 fps (frames per second)
  3. If you wish change the setting. This will slow down or speed up the play rate of your movie.
  4. Click: OK

    Note: Remember that you can change the frame rate at any time.
  5. 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

Step Two: Display Text Box

You need a text box on stage so that the number can be displayed.

  1. With the text tool selected, drag on stage to create an empty text box.
  2. If the Property panel is closed, open it: Window > Properties
  3. In the drop down menu select: Dynamic Text


  4. 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!
  5. 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

  1. Right click on frame one and select: Actions
  2. The Actions panel go to the View Options button and select: Expert Mode
  3. Type the following code:

    onEnterFrame=function(){
        _root.displayNumber=_root._currentframe;
    }


  4. 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.

Please indicate what you thought of this tutorial 
10 is the best: 
10 9 8 7 6 5 4 3 2 1


Webwasp Community: Webwasp Mates & Dates

Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates

32937 visitors to this page since Jan 04

 Top of Page Home Food Mates Members Tutorials Forum Buy Templates Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.