When you load external assets into a movie, you're loading a media file (say an MP3 file, a JPG graphic, or even another SWF) into a Flash movie as it plays. In other words, you're adding assets to your movie. In fact, you can create a Flash movie that contains nothing but script set up to load text, animations, graphics, and sounds from external assets. Media that is loaded dynamically in this fashion can exist on a Web server, or even on a disk or CD if your project is distributed as a projector. Thus, a single project can load media from several sources simultaneously. All that's usually needed is the directory path to the files. It's that simple! No special server technologies required. Sometimes, as is the case when loading media files from a disk or CD, not even a server is required.
By loading external assets (rather than placing all of your project's media in a single SWF), you benefit in a number of ways:
Your movie downloads faster over the Web.
Imagine that you have a site containing four sections Home, Services, Products, and Contact each of which has its own graphic and soundtrack. Together, the graphic and soundtrack add 100k to each section a total of 400k if you place everything in a single SWF. For users connecting via 56Kbps modems, your site will take nearly two minutes to download a sure way to turn viewers away. You're better off loading each section's graphic/soundtrack on an as-needed basis, or only when a user navigates to that section the approach most HTML-based sites take.
You can view multiple movies in the player window without navigating to different HTML pages.
When using a browser to navigate Web sites, you don't need to close one window and then open another just to move from page to page. Instead, the browser remains open while the window's content changes as pages are loaded and unloaded. The same thing happens when external movies are loaded into Flash's player window: The player window simply acts as a container whose contents (a Flash movie) change without the user having to close the movie window or navigate to a different HTML page.
Your project becomes modular and thus easy to update and reuse.
When you begin using assets loaded from external sources in your project, Flash movies become nothing more than interactive modules that you can load, or plug in, to your project at will. Any revisions to a particular module will automatically appear in any bigger project that contains it. Think once again of a standard Web site: Even though each graphic (for example, a logo) usually resides in a single location on the server, multiple pages can contain that logo simply by referencing its directory path on the server that is, you don't need to create a separate logo graphic for each page. This means you can reuse that graphic on any number of pages, and any time you update that graphic all of the pages on which it appears will reflect those changes. The same holds true for externally loaded content in your Flash projects a benefit that cannot be overemphasized since it's much easier to individually edit several smaller, externally loaded files than it is to open a complex project with numerous scenes, layers, tweens, movie clip instances, and scripting every time you need to make a change.
Your project becomes more dynamic, offering each user a unique experience.
Lastly, by loading external assets, you can provide the user with a much more dynamic experience, employing a wider range of content that loads based on time of day, month, user input, or even a randomly generated number.
Although it would be next to impossible to create a single movie that could display appropriate content based on so many variables, using externally loaded assets makes this type of dynamic functionality a breeze.
You can load external assets by using the following actions.
External SWF files: loadMovie() or loadMovieNum()
External JPGs: loadMovie() or loadMovieNum()
External MP3s: loadSound()
In the following exercises you'll learn how to load external SWFs and JPGs as well as external MP3 files. In addition, you'll learn how to control these assets using ActionScript.