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. Select File > New and choose Flash File (ActionScript 2.0).
  2. Drag a Loader component from the Components panel to the Stage.
  3. In the Property inspector, enter the instance name flower.
  4. Select the loader on the Stage and in the Component inspector, and enter http://www.helpexamples.com/flash/images/image1.jpg for the contentPath parameter.
  5. Select Control > Test Movie.

To create a Loader component instance using ActionScript:

  1. Select File > New and choose Flash File (ActionScript 2.0).
  2. Drag the Loader component from the Components panel to the library.
  3. 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.helpexamples.com/flash/images/image1.jpg";
    

    This script uses the method UIObject.createClassObject() to create the Loader instance.

  4. Select Control > Test Movie.