ActionScript 2.0 Components Language Reference |
|
|
|
| CheckBox component > CheckBox.selected | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
checkBoxInstance.selected
Property; a Boolean value that selects (true) or deselects (false) the check box.
The following example shows a check box that has its selected property set to true, by default, and then uses the selected property within an event handler function to respond to the user clicking the check box. Drag the CheckBox component to the Stage. Give the component instance the name my_ch. Then, add the following code to the Actions panel of the first frame of the main timeline:
my_ch.selected = true;
var checkboxListener:Object = new Object();
checkboxListener.click = function(evt_obj:Object) {
if (evt_obj.target.selected) {
evt_obj.target.label = "Selected!";
} else {
evt_obj.target.label = "Unselected!";
}
};
my_ch.addEventListener("click", checkboxListener);
|
|
|
|