ActionScript 2.0 Components Language Reference |
|
|
|
| CheckBox component > CheckBox.labelPlacement | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
checkBoxInstance.labelPlacement
Property; a string that indicates the position of the label in relation to the check box. The following are the four possible values (the dotted lines represent the bounding area of the component; they are invisible in a document):
"right" The check box is pinned to the upper-left corner of the bounding area. The label is set to the right of the check box. This is the default value.

"left" The check box is pinned to the upper-right corner of the bounding area. The label is set to the left of the check box.

"bottom" The label is set below the check box. The check box and label are centered horizontally and vertically.

"top" The label is placed below the check box. The check box and label are centered horizontally and vertically.

You can change the bounding area of a component while authoring by using the Transform command or at runtime using the UIObject.setSize() property. For more information, see Customizing the CheckBox component.
The following example sets the placement of the label to the left of the check box:
checkBox_mc.labelPlacement = "left";
The following example uses ActionScript to create check box instances. The check box instance right_ch has its label and labelPlacement properties set within the method UIObject.createClassObject(). The check box instance left_ch has its label and labelPlacement properties set in separate declarations. Drag the CheckBox component from the Components panel to the current document's library (so the 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, "right_ch", 1, {label:"Right", labelPlacement:"right"});
right_ch.move(10, 10);
this.createClassObject(mx.controls.CheckBox, "left_ch", 2);
left_ch.label= "Left";
left_ch.labelPlacement = "left";
left_ch.move(10, 30);
|
|
|
|