Button.enabled Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
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



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net