User Guide
Using the Loader component 815
The Loader can load content from other domains, if you have policy files in those domains.
See “Allowing cross-domain data loading” in Learning ActionScript 2.0 in Flash.
scaleContent indicates whether the content scales to fit the loader (true), or the loader scales
to fit the content (
false). The default value is true.
You can set the following additional parameters for each Loader component instance in the
Component inspector (Window > Component Inspector):
enabled is a Boolean value that indicates whether the component can receive focus and input.
The default value is
true.
visible is a Boolean value that indicates whether the object is visible (true) or not (false).
The default value is
true.
You can write ActionScript to set additional options for Loader instances using its methods,
properties, and events. For more information, see “Loader class” on page 817.
Creating an application with the Loader component
The following procedure explains how to add a Loader component to an application while
authoring. In this example, the loader loads a logo JPEG from an imaginary URL.
To create an application with the Loader component:
1. Drag a Loader component from the Components panel to the Stage.
2. In the Property inspector, enter the instance name flower.
3. Select the loader on the Stage and in the Component inspector, and enter http://
www.flash-mx.com/images/image1.jpg for the contentPath parameter.
To create a Loader component instance using ActionScript:
1. Drag the Loader component from the Components panel to the library.
2. Select the first frame in the main Timeline, open the Actions panel, and enter the
following code:
this.createClassObject(mx.controls.Loader, "my_loader", 1);
my_loader.contentPath = "http://www.flash-mx.com/images/image1.jpg";
This script uses the method “UIObject.createClassObject()” on page 1362 to create the
Loader instance.
3. Select Control > Test Movie.
NOTE
The minHeight and minWidth properties are used by internal sizing routines. They are
defined in UIObject and are overridden by different components as needed. These
properties can be used if you make a custom layout manager for your application.
Otherwise, setting these properties in the Component inspector has no visible effect.