|
Introduction
Load Movie is an essential command to any serious Flash developer,
as well as any user of third-party SWF software such as SWfX, since
Macromedia Flash can not import Flash 4 or 5 SWFs. Despite its importance,
however, very little information is available on the Load Movie
command and how to use it.
This tutorial covers the basics of using Load Movie in Flash 5.
After reading it, and studying the attached (simple) FLAs, you will
be able to load and control multiple SWFs, using button or frame
actions, with very little hassle.
Basics
Empty
Movie Clips vs. Levels
There are two types of locations into which one may load an external
SWF -- a level, or an empty movie clip. In general, I prefer and
recommend working with empty movie clips, as they are more controllable
and agile at design-time (when you are building your FLA) and at
run-time (dynamically, by ActionScript, when your movie is running).
Loading movies into layers is most useful for loading many, or an
undetermined number of external SWFs, since levels do not need to
be created before loading an SWF into one. To load several SWFs
into movie clips requires the manual placement and naming of the
empty movie clips in Flash, or the use of the Duplicate Movie Clip
command (if you are interested in learning how to use the Duplicate
Movie Clip command for this purpose, please view the Wildform Banner
Ad Engine tutorial, which is intended for advanced Flash developers).
But, on the whole, I find loading SWFs into empty movie clips more
reliable and useful, and the examples in this tutorial are based
on that method. That said, however, with the exception of the final
example, "Controlling SWFs Once Loaded", all of these samples could
just as well apply to loading a movie into a layer rather than an
empty movie clip - simply replace the target of the Load and Unload
Movie Clip commands with a level number.
Positioning
Your SWF
The most common question concerning Load Movie concerns the placement
of external SWFs using empty movie clips. The center point of your
empty movie clip in Flash (the dot on your stage, or the cross-hair
when you edit the movie clip) is where the upper left corner of
your external SWF will be located. That's it. That's the only rule.
If you get it, you should skip the following paragraphs, which contain
a bit more detailed explanation.
Perhaps it might be easiest to think of it in these terms. The upper
left corner of the preview window in SWfX (which is the upper left
corner of the SWF you create) is the 0,0 x-y position. So, for example,
if you place your animation at 20, 30 in SWfX, it will begin 20
points from the left side and 30 points from the top of the preview
window.
In Flash, the 0,0 coordinate in your empty movie clip is the cross
hair that appears in the middle of your stage when you edit the
movie clip. So, an object that appears at (20,30) would appear 20
points to the right and 30 points below the cross hair.
So, to align your movies, all you have to do is align your (0,0)
points - the center-point of your empty movie clip and the upper-left
corner of your SWF.
Loading
Single SWFs 
|