Loading external SWF and image files 597
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 the sample source files, gallery_tree.fla and
gallery_tween.fla, in the Samples folder on your hard disk.
■ 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.
About loading SWF files and the root timeline
The ActionScript property, _root, specifies or returns a reference to the root timeline of a
SWF file. If you load a SWF file into a movie clip in another SWF file, any references to
_root in the loaded SWF file resolve to the root timeline in the host SWF file, not to that of
the loaded SWF file. This action can sometimes cause unexpected behavior at runtime (for
example, if the host SWF file and the loaded SWF file both use
_root to specify a variable).
In Flash Player 7 and later, you can use the
_lockroot (MovieClip._lockroot
property)
property to force references to _root made by a movie clip to resolve to its own
timeline rather than to the timeline of the SWF file that contains that movie clip. For more
information, see “Specifying a root timeline for loaded SWF files” on page 356. For more
information about using
_root and _lockroot, see Chapter 19, “Best Practices and Coding
Conventions for ActionScript 2.0,” on page 731.
One SWF file can load another SWF file from any location on the Internet. However, for a
SWF file to access data (variables, methods, and so forth) defined in another 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 on System.security.allowDomain, see
allowDomain
(security.allowDomain method)
in the ActionScript 2.0 Language Reference and “About
domains, cross-domain security, and SWF files” on page 694.