About the RadioButton component

The RadioButton component allows you to force a user to make a single choice within a set of choices. The RadioButton component must be used in a group of at least two RadioButton instances. Only one member of the group can be selected at any given time. Selecting one radio button in a group deselects the currently selected radio button in the group. You can set the groupName parameter to indicate which group a radio button belongs to.

A radio button can be enabled or disabled. When a user tabs into a radio button group, only the selected radio button receives focus. A user can press the arrow keys to change focus within the group. In the disabled state, a radio button doesn't receive mouse or keyboard input.

A RadioButton component group receives focus if you click it or tab to it. When a RadioButton group has focus, you can use the following keys control it:

Key

Description

Up/Right

The selection moves to the previous radio button within the radio button group.

Down/Left

The selection moves to the next radio button within the radio button group.

Tab

Moves focus from the radio button group to the next component.

For more information about controlling focus, see Creating custom focus navigation or FocusManager class.

A live preview of each RadioButton instance on the Stage reflects changes made to parameters in the Property inspector or Component Inspector panel while authoring. However, the mutual exclusion of selection does not display in the live preview. If you set the selected parameter to true for two radio buttons in the same group, they both appear selected even though only the last instance created will appear selected at runtime. For more information, see RadioButton parameters.

When you add the RadioButton component to an application, you can use the Accessibility panel to make it accessible to screen readers. First, you must add the following line of code to enable accessibility:

mx.accessibility.RadioButtonAccImpl.enableAccessibility();

You only enable accessibility for a component once no matter how many instances you have of the component. For more information, see Creating Accessible Content.