MACROMEDIA FLASH  back to
ACTIONSCRIPT: FPS SPEEDOMETER  


what is "fps"?
fps, or frames per second, is the setting in flash that dictates to the flash player how fast to play back a movie. the default setting is 12, meaning that each frame is displayed on-screen for one twelfth of a second. fps can be set from 0.01 to 120, causing frames to be displayed at the rate of as little as 1 frame every hundred seconds to as many as 120 frames in a single second. in theory, anyway. in reality, most experienced flash developers will at some point have created a movie on their sweet developer box and then cringed as they watched it trickle along on a p90 or a 604 132. the problem is that their own machine plays the movie back at a different frame rate than the slower machine. why? because in flash the "fps" setting doesn't actually stay the same between different machines. fps is like a speed limit: you can tell a movie not to play faster than the specified fps, and all machines will obey, but you can't tell a movie to stay above a certain frame rate. if a machine doesn't have the processing power to render the frames at the specified fps, the movie will simply run more slowly. so, the question for developers has always been *how much slower*?

determining the actual fps
thanks to a little actionscript, we're finally going to find out how fast flash movies actually play back. with the "moock fps speedometer" we can see the actual framerate of any movie as it runs on any machine. here's what it looks like in action:

> view the moock fps speedometer

by using the speedometer above, you can test the basic maximum framerate of flash on any machine. the frame rate of the fps speedometer is set to 30. you'll likely never see 30 though because the movie itself requires some processing power from flash. but you're probably more interested in the frame rate of your own movies, which is what the fps speedometer is really made for. follow the directions below to add a speedometer to an existing movie. once you've added the speedometer to a movie, you should determine its framerate while it is running on the slowest machine you expect your users to have. then set your frame rate to be slightly higher than that to ensure uniform playback on all machines.

adding the moock fps speedometer to your movies
  1. right click (ctrl+click on mac) to download the speedometer: flash 4 version || flash 5 version
  2. open the fla file to which you want to add the speedometer.
  3. create a new layer in your movie named "speedometer".
  4. open the fla file of the speedometer.
  5. in the speedometer fla file, you'll see a single movie clip on a layer called "fpsSpeedometer". copy that movie clip (edit>>copy), and paste it onto the speedometer layer of your other movie (you use "copy/paste" so the instance name of the movie clip is retained).
  6. export your movie and watch the speedometer go. a couple of tips on using it: 1) you can drag the speedometer around by the title bar (drag it off the graphically intense parts of your movie for a more accurate reading) 2) the top line gives the average fps for the entire movie, the bottom line gives the fps of the last segment of frames...you can set that segment from 10-100 using the pulldown menu.
  7. when you want to export your movie without the speedometer, simply make the speedometer layer into a guide layer.
revision history
july 26, 1999: posted.
june 27, 2001: created flash 5 version.