Chapter 13. Loading Assets

IN THIS CHAPTER

Loading SWFs and Images

Loading Data

Communicating with Loaded SWFs

Additional Online Resources

What’s Next?

You don’t always need to load external assets at runtime, but the ability to do so is extremely important. Loading assets on the fly reduces initial file size and, therefore, load times. It also increases the degree to which a Flash experience can change—not only through the all-important dynamic nature of runtime content updates, but also by streamlining the editing process. For example, you can alter external assets easier and faster than you can republish an FLA file every time an update occurs.

Augmenting prior discussions regarding sound, video, and plain text, this chapter will teach you how to load external SWFs and images. You’ll also take a peek at loading variables and binary data, and see how to increase your error checking efforts. Specifically, we’ll look at:

  • Loading SWFs and Images. Right out of the gate, it’s fairly easy to load SWFs and JPG, PNG, and GIF images. Third-party ActionScript libraries support loading even more asset types. We’ll look at simple syntax examples and then build a multipurpose class that can handle some error checking and reporting for you automatically.

  • Loading Data. Next we’ll discuss loading text, URL variables, and binary data. We discussed loading text from external sources in Chapter 10 but limited our coverage to loading HTML and CSS information. In this chapter, we’ll expand the scope of our ...

Get Learning ActionScript 3.0, 2nd Edition 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.