CheckBox.label

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

checkBoxInstance.label

Description

Property; indicates the text label for the check box. By default, the label appears to the right of the check box. Setting this property overrides the label parameter specified in the Parameters tab of the Component inspector. 

The CheckBox component does not allow multiline labels.

Example

The following code sets the text that appears beside the CheckBox component and sends the value to the Output panel:

checkBox.label = "Remove from list"; 
trace(checkBox.label)

This example creates the check box in ActionScript, and then resizes the label when checked. For this example, drag a CheckBox component from the Components panel to the current document's library (so the CheckBox component appears in your library, but not on the Stage). Then add the following ActionScript to the first frame of the main timeline:

this.createClassObject(mx.controls.CheckBox, "my_ch", 10, {label:"Resize CheckBox instance"});

function checkboxHandler(evt_obj:Object):Void {
 trace("before: " + evt_obj.target.width +"px wide");
 evt_obj.target.setSize(200, evt_obj.target.height);
 trace("after: " + evt_obj.target.width+"px wide");
}
my_ch.addEventListener("click", checkboxHandler);

See also

CheckBox.labelPlacement