Creating an application with the RadioButton component

The following procedure explains how to add RadioButton components to an application while authoring. In this example, the radio buttons are used to present the yes-or-no question "Are you a Flashist?". The data from the radio group is displayed in a TextArea component with the instance name theVerdict.

To create an application with the RadioButton component:

  1. Select File > New and choose Flash File (ActionScript 2.0).
  2. Drag two RadioButton components from the Components panel to the Stage.
  3. Select one of the radio buttons. In the Component inspector, do the following:
    • Enter Yes for the label parameter.
    • Enter Flashist for the data parameter.
  4. Select the other radio button. In the Component inspector, do the following:
    • Enter No for the label parameter.
    • Enter Anti-Flashist for the data parameter.
  5. Drag a TextArea component from the Components panel to the Stage and give it an instance name of theVerdict.
  6. Select Frame 1 in the main Timeline, open the Actions panel, and enter the following code:
    flashistListener = new Object();
    flashistListener.click = function (evt){
            theVerdict.text = evt.target.selection.data
    }
    radioGroup.addEventListener("click", flashistListener);
    

    The last line of code adds a click event handler to the radioGroup radio button group. The handler sets the text property of theVerdict (a TextArea instance) to the value of the data property of the selected radio button in the radioGroup radio button group. For more information, see RadioButton.click.