Recipe 3.3. Setting the Frame Rate


Problem

You want to set the frame rate of a Flash document.

Solution

Set the frame rate value in the Document Properties or in the Property inspector.

Discussion

To register in the human brain, an image needs a certain amount of timeit is not instantaneous; this is referred to as persistence of vision. If an animation or video format displays images faster than the time the brain requires to process an image, the illusion of fluid motion is created. If, on the other hand, images are displayed slower than the persistence of vision, individual images are perceptible, and the animation or video looks uneven. In animation and video each image in the sequence is called a frame. Higher frame rates (more frames per second) generally result in smoother animation.

Unless you change the default settings, Flash uses 12 frames per second for new documents. However, the setting of 12 frames per second is not optimal in every situation. High-quality animation and video outlets, such as television and movies, use nearly 30 frames per second, so Flash's default setting is obviously lower in quality than those media. However, before you set the frame rate of a Flash document to 30 or greater (Flash allows a maximum frame rate of 120 frames per second) you need to consider whether the SWF will be able to run at that frame rate.

There are two basic factors that affect the actual frame rate at which an SWF plays backthe amount of processing power required by the SWF and the amount of processing power available on the computer playing back the SWF. If a computer simply cannot play back the SWF at the frame rate set for the document, Flash Player will play back the SWF at the maximum frame rate it can. And the frame rate during playback can fluctuate. For example, if an SWF has a frame rate setting of 30 frames per second, it may start at 30 frames per second as long as nothing is on stage. However, if 5 seconds into the animation there are objects flying around on stage, the frame rate might drop to 20. The effect is that the playback appears to slow down and appear choppy at times.

Although you cannot guarantee that an SWF will play back at a consistent frame rate on every computer every time, there are some steps you can take to help improve the likelihood that it will run as consistently as possible:

  • Determine the minimum system requirements of your audience, and test using equivalent computers. For example, if you know that 50% of your audience uses Pentium III 1GHz computers, you ought to test using a similar system.

  • Before you build the entire SWF, start with a simple test SWF that incorporates some of the most processor-intensive aspects of the project. Use that to determine what frame rates will work for the project.

  • Use a utility such as the FrameRateCheckerUtility component from the Flash 8 Cookbook components (see the Preface). Using the FrameRateCheckerUtility you can determine the actual playback frame rate.

Flash's default of 12 frames per second is often a good option with complex animations, such as cartoons, destined for web distribution. Faster frame rates tax the processor, often forcing Flash to skip frames, which defeats the purpose of the higher frame rate. In addition, high frame rates often require more assets, hence ensuring longer downloads; usually these also require more time and effort to animate. In contrast, if you drop the frame rate lower than 12 frames per second, then the quality of the animation drops further.

More so than any other document setting, it is important to select the frame rate before starting a Flash project. If you change the frame rate after the project has already started, it will cause existing animations to speed up or slow down. For example, if you change the frame rate from 12 to 24, the timelines will play back twice as fast. That means that a motion tween that spans 48 frames used to take 4 seconds, but with the new setting it happens in just 2 seconds.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net