Button.enabled Property | Flash 6 |
Boolean; allows or disallows button interaction | read/write |
The Boolean enabled property turns a button on (true) and off (false). It defaults to true. When enabled is false, theButton does not receive any user input; the hand cursor is not shown, no events are triggered, and only the Up state is displayed. However, a disabled button can still receive keyboard focus with the Tab key. To disable tab focus, set theButton.tabEnabled to false.
The Tab key does not work reliably in Test Movie mode unless Control Disable Keyboard Shortcuts is enabled. Be sure to test keyboard behavior in the Standalone Player, if applicable, and in the Flash Player for all targeted web browsers.
Buttons can be disabled in order to control a user's interaction with an interface. For example, a form's Submit button can be disabled until all of the form's input text fields have been filled out by the user:
// Disable the Submit button at the outset submit_btn.enabled = false; submit_btn.tabEnabled = false; // Add code that reenables the button when all fields have been filled out... // For example: mandatoryField.onChanged = function () { if (this.text != "") { submit_btn.enabled = true; submit_btn.tabEnabled = true; } }
Button.tabEnabled, Button.useHandCursor