User Guide

484 Chapter 6: Components Dictionary
Loader component
The Loader component is a container that can display a SWF or JPEG file. You can scale the
contents of the loader or resize the loader itself to accommodate the size of the contents. By
default, the contents are scaled to fit the loader. You can also load content at runtime and monitor
loading progress.
A Loader component cant receive focus. However, content loaded into the Loader component
can accept focus and have its own focus interactions. For more information about controlling
focus, see “Creating custom focus navigation” on page 50 or “FocusManager class” on page 419.
A live preview of each Loader instance reflects changes made to parameters in the Property
inspector or Component inspector during authoring.
You can use the Accessibility panel to make Loader component content accessible to screen
readers. For more information, see Chapter 17, “Creating Accessible Content,” in Using Flash.
Using the Loader component
You can use a loader whenever you need to retrieve content from a remote location and pull it
into a Flash application. For example, you could use a loader to add a company logo (JPEG file)
to a form. You could also use a loader to leverage Flash work that has already been completed. For
example, if you had already built a Flash application and wanted to expand it, you could use the
loader to pull the old application into a new application, perhaps as a section of a tab interface. In
another example, you could use the loader component in an application that displays photos. Use
Loader.load(), Loader.percentLoaded, and Loader.complete to control the timing of the
image loads and display progress bars to the user during loading.
If you load certain version 2 components into a SWF file or into the Loader component, the
components may not work correctly. These components include the following: Alert,
ComboBox, DateField, Menu, MenuBar, and Window.
Use the
_lockroot property when calling loadMovie() or loading into the Loader component.
If youre using the Loader component, add the following code:
myLoaderComponent.content._lockroot = true;
If youre using a movie clip with a call to loadMovie(), add the following code:
myMovieClip._lockroot = true;
If you dont set _lockroot to true in the loader movie clip, the loader only has access to its own
library, but not the library in the loaded movie clip.
The
_lockroot property is supported by Flash Player 7. For information about this property, see
MovieClip._lockroot in Flash ActionScript Language Reference.
Loader parameters
You can set the following authoring parameters for each Loader component instance in the
Property inspector or in the Component inspector:
autoload indicates whether the content should load automatically (true), or wait to load until
the
Loader.load() method is called (false). The default value is true.
CHAPTER 6
Components Dictionary