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. 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 either the loadMovie() or loadMovieNum() function, or the MovieClip.loadMovie() method. 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.

To play back an external MP3 (MPEG Layer 3) file, use the loadSound() method of the Sound class. This method lets you specify whether the MP3 file should stream or download completely before it starts to play. You can also read the ID3 information embedded in MP3 files, if they're available. For more information, see Reading ID3 tags in MP3 files.

Flash Video (FLV) is the native video format used by Flash Player. You can play back FLV files over HTTP, or from the local file system. Playing external FLV files provides several advantages over embedding video in a Flash document, such as better performance and memory management, and independent video and Flash frame rates. For more information, see Playing back external FLV files dynamically.

You can also preload, or track the download progress, of external media. Flash Player 7 introduces the MovieClipLoader class, which you can use to track the download progress of SWF or JPEG files. To preload MP3 and FLV files, you can use the getBytesLoaded() method of the Sound class and the bytesLoaded property of the NetStream class. For more information, see Preloading external media.