The following code loads the JPEG image flowers.jpg into the movie clip instance
image_clip.loadMovie("flowers.jpg");
For more information about these methods, see
MovieClip.loadMovie()
For more information about loading external SWF and JPEG files, see the next section.
About loaded SWF files and the root Timeline
The ActionScript property
file. If you load a SWF file into a movie clip in another SWF file, any references to
loaded SWF file resolve to the root Timeline in the host SWF file, not to that of the loaded SWF
file. This can sometimes cause unexpected behavior at runtime (for example, if the host SWF file
and the loaded SWF file both use
In Flash Player 7 and later, you can use the
made by a movie clip to resolve to its own Timeline rather than to the Timeline of the
_root
SWF file that contains that movie clip. For more information, see
loaded SWF files" on page
Chapter 3, "Using scope," on page
One SWF file can load another SWF file from any location on the Internet. However, for one
SWF file to access data (variables, methods, and so forth) defined in the other SWF file, the two
files must originate from the same domain. In Flash Player 7 and later, cross-domain scripting is
prohibited unless the loaded SWF file specifies otherwise by calling
System.security.allowDomain()
For more information, see
Reference and
"Flash Player security features" on page
Loading external MP3 files
To load MP3 files at runtime, you use the
create a Sound object, as shown in the following example:
var song1_sound:Sound = new Sound();
Then you use the new object to call
sounds are loaded completely before being played; streaming sounds play as they are downloaded.
You can set the
isStreaming
a streaming sound. After you load an event sound, you must call the
Sound class to make the sound play. Streaming sounds begin playing when sufficient data is
loaded into the SWF file; you don't need to use
For example, the following code creates a Sound object named
MP3 file named beethoven.mp3:
var classical:Sound = new Sound();
classical.loadSound("http://server.com/mp3s/beethoven.mp3", true);
loadMovie()
in Flash ActionScript Language Reference.
specifies or returns a reference to the root Timeline of a SWF
_root
to specify a variable).
_root
MovieClip._lockroot
208. For more information about using
95.
.
System.security.allowDomain()
loadSound()
loadSound()
parameter of
loadSound()
start()
,
loadMovieNum()
property to force references to
"Specifying a root Timeline for
_root
in Flash ActionScript Language
288.
method of the Sound class. First, you
to load an event or a streaming sound. Event
to specify a sound as an event sound or
start()
.
classical
Loading external MP3 files
:
image_clip
, and
in the
_root
and
, see
_lockroot
method of the
and then loads an
297
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?