User Guide

Loader component 485
contentPath an absolute or relative URL indicating the file to load into the loader. A relative
path must be relative to the SWF file loading the content. The URL must be in the same
subdomain as the URL where the Flash content currently resides. For use in Flash Player or in
test-movie mode, all SWF files must be stored in the same folder, and the filenames cannot
include folder or disk drive specifications. The default value is
undefined until the load starts.
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 write ActionScript to set additional options for Loader instances using its methods,
properties, and events. For more information, see “Loader class” on page 486.
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.
Select the loader on the Stage and use the Free Transform tool to size it to the dimensions of
the corporate logo.
3.
In the Property inspector, enter the instance name logo.
4.
Select the loader on the Stage and in the Component inspector, and enter http://corp.com/
websites/logo/corplogo.jpg for the contentPath parameter.
Customizing the Loader component
You can transform a Loader component horizontally and vertically while authoring and at
runtime. While authoring, select the component on the Stage and use the Free Transform tool or
any of the Modify > Transform commands. At runtime, use the
setSize() method (see
UIObject.setSize()).
The sizing behavior of the Loader component is controlled by the
scaleContent property. When
scaleContent is true, the content is scaled to fit within the bounds of the loader (and is rescaled
when
UIObject.setSize() is called). When scaleContent is false, the size of the component
is fixed to the size of the content and
UIObject.setSize() has no effect.
Using styles with the Loader component
The Loader component uses the following styles.
Style Theme Description
border styles
Both The Loader component uses a RectBorder instance as its
border and responds to the styles defined on that class. See
“RectBorder class” on page 647.
The default border style is
"none".