Chapter 10. Loading Assets On the Fly

In this chapter we really begin to flex our Flash muscles. We’ll load external JPEGs on the fly, use ActionScript to create a preloader, optimize images in Fireworks, use built-in components, and even create our own custom component. So hang on tight!

This chapter focuses almost entirely on solving one problem: finding the best way to load external assets into a Flash movie while it’s running. This goal can be accomplished in several ways, and each approach has its merits. We’ll work with each method and learn which is best in any given situation.

“So,” you wonder, “why do I want to load assets into a Flash movie dynamically when I can just import them at authoring time?” And that is a good question, for which there are several answers.

First, as good as Flash’s built-in compression engine is, it’s not good enough in all situations. You can’t import a bitmap image weighing 100 KB into a Flash document and expect to produce a .swf file that is small enough to load quickly over a dial-up connection.

Second, 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 things can all be created with Flash, and it is rarely an economical use of file size to cram all the necessary assets into one Flash document. Adding one bitmap image to a Flash project may not affect the file size much, but try adding 10, each of which is used in a different screen ...

Get Flash Out of the Box now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.