Chapter 20. Building Preloaders

Flash movies begin playback as soon as the first frame is loaded. This default behavior generally works well with compact Flash vector graphics. However, when you use other kinds of assets—notably, bitmap graphics, sound, video, and/or Flash components—Flash’s default behavior can lead to stuttered, delayed, and broken playback. The cause of the unacceptable playback is that Flash is forced to try to play frames back that haven’t been loaded yet.

For example, imagine a movie that has a frame rate of 12 frames per second. On frame 12, a keyframe contains a bitmap graphic that is 36 kilobytes in size. Even assuming that there is no other content in the movie, to display this frame at the proper time, Flash would have to download at a rate of 36 kilobytes per second, or 3 kilobytes for every frame. But a user on a modem may be able to download only 2–4 kilobytes per second. In this case, the playhead would reach frame 12 before its contents were loaded, and Flash would stop playback and wait for the content to load. Obviously, the lower the user’s bandwidth, the more pronounced the problems are; thus, modem users are much more likely to experience poor playback than users on a corporate intranet.

Flash has a built-in tool, the Bandwidth Profiler, which can be used to simulate the playback of a movie at different connection speeds. For example, you can have Flash play back the movie assuming that the movie downloads at a rate of 4.7 kilobytes per second, ...

Get Flash 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.