User Guide
295
CHAPTER 12
Working with External Media
If you import an image or a sound while you author a document in Macromedia Flash MX 2004
or Macromedia Flash MX Professional 2004, the image and sound are packaged and stored in the
SWF file when you publish it. In addition to importing media while authoring, you can load
external media, including other SWF files, at runtime. There are several reasons you might want
to keep media outside a Flash document.
Reduce file size By keeping large media files outside your Flash document and loading them at
runtime, you can reduce the initial download time for your applications and presentations,
especially over slow Internet connections.
Modularize large presentations You can divide a large presentation or application into
separate SWF files and then load those separate files as needed at runtime. This process reduces
initial download time and also makes maintaining and updating the contents of the presentation
easier.
Separate content from presentation This theme is common in application development,
especially data-driven applications. For example, a shopping cart application might display a
JPEG image of each product. By loading the JPEG files for each image at runtime, you can easily
update a product’s image without modifying the original FLA file.
Take advantage of runtime-only features Some features, such as dynamically loaded FLV and
MP3 playback, are available only at runtime through ActionScript.
Overview of loading external media
There are four types of media files that you can load into a Flash application at runtime: SWF,
MP3, JPEG, and FLV files. Macromedia Flash Player can load external media from any HTTP or
FTP address, from a local disk using a relative path, or by using the
file:// protocol.
To load external SWF and JPEG files, you can use the
loadMovie() or loadMovieNum()
function, the MovieClip.loadMovie() method, or the MovieClipLoader.loadClip() method.
The class methods generally provide more function and flexibility than global functions and are
appropriate for more complex applications. When you load a SWF or JPEG file, you specify a
movie clip or movie level as the target for that media. For more information on loading SWF and
JPEG files, see “Loading external SWF and JPEG files” on page 296.