Chapter 15. Loading Assets

Introduction

Loading external .swf files into a Flash movie has long been a part of ActionScript. Beginning with Flash Player 6 it is also possible to load JPEG and MP3 files into a Flash movie at runtime. The implications of this are rather important. There are many good reasons for loading external content into your Flash movies at runtime, such as:

  • It is easier and more convenient to manage external assets than to have to open the Flash document, import new or modified assets, and re-export the .swf file each time you want to make a change.

  • In larger applications it makes sense to have different .swf files that are authored by different people or teams that can be assembled at runtime by a main, loading movie. This solves the bottleneck problems that can occur when trying to author a single .swf file (since only one person at a time can edit a Flash document).

  • By loading external assets, you can create applications in which users can load their own assets into the Flash movie (for an example, see the jukebox application in Chapter 26).

  • Loading external assets at runtime enables you to download assets to the client’s computer as they are requested. This is important for large applications. For example, consider an application that allows a user to view photographs of a room in order to select a paint color. The application might allow a user to select from 90 colors, and each color selection might display a different version of the same photograph in which ...

Get Actionscript 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.