About the CheckBox component

A check box is a square box that can be either selected or deselected. When it is selected, a check appears in the box. You can add a text label to a check box and place it to the left, right, top, or bottom.

A check box can be enabled or disabled in an application. If a check box is enabled and a user clicks it or its label, the check box receives input focus and displays its pressed appearance. If a user moves the pointer outside the bounding area of a check box or its label while pressing the mouse button, the component's appearance returns to its original state and it retains input focus. The state of a check box does not change until the mouse is released over the component. Additionally, the checkbox has two disabled states, selected and deselected, which do not allow mouse or keyboard interaction.

If a check box is disabled it displays its disabled appearance, regardless of user interaction. In the disabled state, a button doesn't receive mouse or keyboard input.

A CheckBox instance receives focus if a user clicks it or tabs to it. When a CheckBox instance has focus, you can use the following keys to control it:

Key

Description

Shift + Tab

Moves focus to the previous element.

Spacebar

Selects or deselects the component and triggers the click event.

Tab

Moves focus to the next element.

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

A live preview of each CheckBox instance reflects changes made to parameters in the Property inspector or Component Inspector panel while authoring.

When you add the CheckBox 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.CheckBoxAccImpl.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.