RadioButton.selectedData

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

radioButtonGroup.selectedData

Description

Property; selects the radio button with the specified data value and deselects the previously selected radio button. If the data property is not specified for a selected instance, the label value of the selected instance is selected and returned. The selectedData property can be of any data type.

Example

The following example creates three radio buttons in a radio group, positions the buttons, and selects the button that has a data value of 10, which is the second button.

You first drag a RadioButton component from the Components panel to the current document's library, and then add the following code to Frame 1 of the main timeline.

/**
 Requires:
  - RadioButton component in library
*/

import mx.controls.RadioButton;

this.createClassObject(RadioButton, "first_rb", 10, {label:"first", data:5, groupName:"radioGroup"});
this.createClassObject(RadioButton, "second_rb", 20, {label:"second", data:10, groupName:"radioGroup"});
this.createClassObject(RadioButton, "third_rb", 30, {label:"third", data:15, groupName:"radioGroup"});

// Position radio buttons on Stage.
second_rb.move(0, first_rb.y + first_rb.height);
third_rb.move(0, second_rb.y + second_rb.height);

radioGroup.selectedData = 10;