Chapter 12. Loading Assets on the Fly

This chapter focuses almost entirely on solving one problem: keeping initial download times to a minimum without compromising too much quality or creativity. This goal can be accomplished in several ways, and each approach has its merits. Perhaps the method that achieves the most successful mix of optimization and quality, however, is loading assets on demand.

Flash projects are often more complex than what we’ve created so far in this book. Web sites, photo galleries, presentations, printable advertisements, and many other projects can all be created with Flash, and it is rarely an economical use of file size to cram all the necessary assets into one .swf. Adding 1 bitmap image to a Flash project may not affect the file size much, but adding 10 can really make a difference.

Splitting projects into multiple pieces and loading each module only when it’s required is key to creating Flash content that runs smoothly and loads quickly. You may be thinking that using external assets simply shifts the download burden to a later time. That’s true, but the point is that the external content may never be needed and, therefore, may never be loaded.

Another benefit of external assets is that they make complex Flash projects easier to manage and update. A modular structure can speed up development significantly, for a variety of reasons. First, smaller files are typically easier to ...

Get Flash 8: Projects for Learning Animation and Interactivity 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.