Table of Contents

Button.enabled Property Flash 6

Boolean; allows or disallows button interaction read/write
theButton.enabled

Description

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.

Usage

The Tab key does not work reliably in Test Movie mode unless Control figs/U2192.gif 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.

Example

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;
  }
}

See Also

Button.tabEnabled, Button.useHandCursor


Table of Contents