RadioButton.data

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

radioButtonInstance.data

Description

Property; specifies the data to associate with a RadioButton instance. Setting this property overrides the data parameter value set during authoring. The data property can be of any data type.

Example

The following example assigns the data value 0xFF00FF and the label #FF00FF to the radio button instance my_rb. It then creates a listener for a click event and displays the button's data value when a user clicks the 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
*/

this.createClassObject(mx.controls.RadioButton, "my_rb", 10, {label:"first", groupName:"radioGroup"});

my_rb.data = 0xFF00FF;
my_rb.label = "#FF00FF";
var rbListener:Object = new Object(); 
rbListener.click = function(evt_obj:Object){
   trace("The data value for my_rb is " + my_rb.data);
} 
// Add listener.
my_rb.addEventListener("click", rbListener);