EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - About Loading and Working with External Media

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
592 Working with Images, Sound, and Video
About loading and working with
external media
You can load several types of media files into a Flash application at runtime: SWF, MP3,
JPEG, GIF, PNG, and FLV files. However, not all versions of Flash Player support each kind
of media. For more information on the image file types that are supported in Macromedia
Flash Player 8, see “Loading external SWF and image files” on page 593. For information on
FLV video support in Flash Player, see About using FLV video” on page 603
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 image 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 image
file, you specify a movie clip or SWF file level as the target for that media. For more
information on loading SWF and image files, see “Loading external SWF and image files
on page 593.
To play back an external MP3 file, use the
loadSound() method of the Sound class. This
method lets you specify whether the MP3 file should progressively download or complete
downloading 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
on page 601.
Flash Video is the native video format used by Flash Player. You can play FLV files over
HTTP or from a local file system. Playing external FLV files provides several advantages over
embedding video in a Flash document, such as better performance and memory management
as well as independent video and Flash frame rates. For more information, see Playing back
external FLV files dynamically” on page 606.
You can also preload or track the downloading progress of external media. Flash Player 7
introduced the MovieClipLoader class, which you can use to track the downloading progress
of SWF or image 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 FLV files” on page 609.
You can find samples of photo gallery applications on your hard disk.These files provide
examples of how to use ActionScript to control movie clips dynamically while loading image
files into a SWF file. You can find gallery_tree.fla and gallery_tween.fla, the sample source
files, in the Samples folder on your hard disk.

Table of Contents

Related product manuals