User Guide
89
4
CHAPTER 4
Button component
The Button component is a resizable rectangular user interface button. You can add a custom
icon to a button. You can also change the behavior of a button from push to toggle. A toggle
button stays pressed when clicked and returns to its up state when clicked again.
A button can be enabled or disabled in an application. In the disabled state, a button doesn’t
receive mouse or keyboard input. An enabled button receives focus if you click it or tab to it.
When a Button instance has focus, you can use the following keys to control it:
For more information about controlling focus, see “FocusManager class” on page 721 or
“Creating custom focus navigation” in Using Components.
A live preview of each Button instance reflects changes made to parameters in the Property
inspector or Component inspector during authoring. However, in the live preview a custom
icon is represented on the Stage by a gray square.
When you add the Button 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:
mx.accessibility.ButtonAccImpl.enableAccessibility();
You enable accessibility for a component only once. regardless of how many instances you
have of the component.
Key Description
Shift+Tab Moves focus to the previous object.
Spacebar Presses or releases the component and triggers the
click event.
Tab Moves focus to the next object.