Loading external SWF and image files
593
■
In Windows, browse to
boot drive
\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\Galleries.
■
On the Macintosh, browse to
Macintosh HD
/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/Galleries.
Loading external SWF and image files
To load a SWF or image file, use the
loadMovie()
or
loadMovieNum()
global function, the
loadMovie()
method of the MovieClip class, or the
loadClip()
method of the
MovieClipLoader class. For more information on the
loadClip()
method, see
MovieClipLoader.loadClip()
in the
ActionScript 2.0 Language Reference.
For image files, Flash Player 8 supports the JPEG (progressive and non-progressive) image file
type, GIF images (transparent and non-transparent, although only the first frame of an
animated GIF will be loaded), and PNG files (transparent and non-transparent).
To load a SWF or image file into a level in Flash Player, use the
loadMovieNum()
function.
To load a SWF or image file into a movie clip target, use the
loadMovie()
function or
method. In either case, the loaded content replaces the content of the specified level or target
movie clip.
When you load a SWF or image file into a movie clip target, the upper-left corner of the SWF
file or image is placed on the registration point of the movie clip. Because this registration
point is often the center of the movie clip, the loaded content might not appear centered.
Also, when you load a SWF file or image to a root timeline, the upper-left corner of the image
is placed on the upper-left corner of the Stage. The loaded content inherits rotation and
scaling from the movie clip, but the original content of the movie clip is removed.
You can optionally send ActionScript variables with a
loadMovie()
or
loadMovieNum()
call.
This is useful, for example, if the URL you’re specifying in the method call is a server-side
script that returns a SWF or image file according to data passed from the Flash application.
When you use the global
loadMovie()
or
loadMovieNum()
function, specify the target level
or clip as a parameter. The following example loads the Flash application contents.swf into the
movie clip instance named
image_mc
:
loadMovie("contents.swf", image_mc);
You can use
MovieClip.loadMovie()
to achieve the same result:
image_mc.loadMovie("contents.swf");
The following example loads the image1.jpg JPEG image into the
image_mc
movie clip
instance:
image_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...