Performance Hits

 < Day Day Up > 

So far, this hour has covered optimization as it applies to making files smaller (so they download quickly). The other side of optimization involves making a movie play quickly in other words, ensuring that its performance is consistent and smooth on all users' computers. If you set your frame rate to, say, 12 fps, it will never exceed that number. However, on some computers, it might slow to a lower rate. Unfortunately, there isn't a "Performance Profiler" (similar to the Bandwidth Profiler) where you can simulate performance on other machines. There are far too many variables that can affect playback speed. For the rest of this hour, we'll look at ways to avoid common performance hits to ensure the best possible performance on every user's machine.

Avoiding Gratuitous Special Effects

In previous hours you learned how unnecessary special effects can distract users from your core message. However, there's another reason to avoid gratuitous special effects: Having too many effects can cause a movie to play slowly. For example, it might not be necessary to rotate and motion tween each piece of text that appears onscreen. Maybe this is interesting for the first block of text, but it can get tiring to wait for each to do its animation. Plus, if a user's computer slows down for each tween, the effect is even more disruptive.

Although a motion tween involving a change in the Alpha effect may be necessary to communicate a particular message, this kind of tween should be used with caution. Not only does the computer need to display the object that's moving, but it also needs to display a semitransparent version of the object, which means it must display the graphics underneath the object. Simply put, this means slower machines might not be able to keep up with the desired frame rate. Often, an Alpha effect isn't even needed. For example, if your background is white, a simple Brightness effect will look the same and perform slightly better than an Alpha effect.

Another significant performance hit that can often be avoided involves tweens that scale, move, or change the Alpha setting of a bitmap. Generally, Flash does not excel in the display of bitmaps. Changing the size of a bitmap makes the computer do a lot of work. Even if you have a fast machine, you can see this behavior by first setting the frame rate to a high value (such as 60 fps) and then performing a simple motion tween on a bitmap. Select Control, Play (not Test Movie) to watch your movie play inside Flash. Then change the scale of the bitmap on either the keyframe or the tween and play it again. You should see the actual frame rate drop during the tween that involves scale.

Other special effects such as Filters can slow down performance, too. One way to preview such performance hits is by temporarily setting the frame rate very high (say, 60 fps) and then testing before and after you try different approaches to see how they cause the movie to slow or play in a jerky manner. Keep in mind the suggestion earlier in this section and simply avoid unnecessary special effects. If you really need to use an effect, go ahead. Just be careful with those that really cause the movie to slow down because they might cause your users' computers to slow down even further.

Avoiding Streaming Sounds

When you place sounds in keyframes, you have a choice between the Sync settings Event and Stream. You should generally use Event or one of the other event-like choices, Start or Stop. These will have the least impact on performance. Stream is useful when you need synchronization to be maintained. When you use Stream sounds, you can hear the sounds play as you scrub the Timeline. Stream sounds are comparable to Graphic symbols, whose animation you can also preview when you scrub. The disadvantage to Stream sounds, however, is that the visual parts of the movie will be sacrificed when a computer can't keep up. That is, Stream sounds are always synchronized, and if the computer can't display the graphics in time, Flash will drop visual frames to keep up with the sound. Therefore, Stream sounds can make the graphics appear to skip and jump. This is simply due to the fact that Flash will never cause the sound to play slowly because it would sound funny if it did.

Event sounds will play as soon as they can. If the computer can keep up, these sounds will play as expected (that is, when the appropriate keyframes are reached). Also, graphics will display as soon as they can. However, on slow machines, the graphics may take longer to display, so the sound may not stay in perfect synchronization. That's not to say you can't achieve a decent result with Event sounds. Consider cutting the sound files into shorter bits before importing them. You can place sounds in the Timeline so that they line up closely with graphics. It still won't be perfect, but at least no frames will be dropped. If you don't need critical synchronization, use Event sounds because both the graphics and the sounds will play smoothly they just might not be perfectly synchronized.

Graphic Issues

Here are a few tips to assure the best performance possible.

Using Optimize Curves

Earlier in this hour you saw how you can optimize any drawn shape by selecting Modify, Shape, Optimize. Using the Optimize Curves feature will remove curves from a shape, making it look more streamlined. Sometimes the visual impact is subtle but the file size reduction is significant. Other times, the visual change is too great to be acceptable, as is the case in Figure 21.14. Consider optimizing any time the visual change is acceptable. In addition to making the file smaller, it often speeds playback performance (yet another reason to use it).

Figure 21.14. Two shapes are shown before and after Optimize Curves is applied. Sometimes the results may be unacceptable.

Never Using Modify, Shape, Soften Fill Edges

Never is a strong word, but it applies in this case. It doesn't take more than a few minutes to calculate both the file size difference and the performance difference for a shape drawn and then softened. Try a test where you create a simple shape tween. Test the movie and note the file size in the Bandwidth Profiler. Play the movie inside Flash and note the actual frame rate. Then, individually select the shape at each end of the tween and use Modify, Shape, Soften Fill Edges. You'll see the file size jump and the performance drop. I suppose the one situation when you might consider using this feature is when you're only exporting a static image (that is, if you're using Flash as a drawing tool). You're much better off using Flash 8 Professional's Blur filter both for file size savings and performance.

Avoiding Line Styles

You saw in Hour 2, "Drawing and Painting Original Art in Flash," that when you draw a line, the Properties panel drop-down list for stroke style gives you lots of patterns (see Figure 21.15). Try to use only the Solid and Hairline styles. The others tend to make movies much larger. I can't say that with them you'll always see the performance drop, but you'll certainly see your file size increase.

Figure 21.15. You should try to use only the Hairline and Solid stroke styles.

     < Day Day Up > 

    Sams Teach Yourself Macromedia Flash 8 in 24 Hours
    Sams Teach Yourself Macromedia Flash 8 in 24 Hours
    ISBN: 0672327546
    EAN: 2147483647
    Year: 2006
    Pages: 235

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: