Creating an application with the Label component

The following procedure explains how to add a Label component to an application while authoring. In this example, the label is beside a combo box with dates in a shopping cart application.

To create an application with the Label component:

  1. Confirm that your Publish Settings specify ActionScript 2.0.
  2. Drag a Label component from the Components panel to the Stage.
  3. In the Component inspector, enter Expiration Date for the label parameter.

To create a Label component instance using ActionScript:

  1. Confirm that your Publish Settings specify ActionScript 2.0.
  2. Drag the Label component from the Components panel to the current document's library.

    This adds the component to the library, but doesn't make it visible in the application.

  3. Select the first frame in the main Timeline, open the Actions panel, and enter the following code:
    this.createClassObject(mx.controls.Label, "my_label", 1);
    my_label.text = "Hello World";
    

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

  4. Select Control > Test Movie.