TextField.tabEnabled Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
TextField.tabEnabled Property Flash 6

Boolean; includes or excludes the field from the current tab order read/write
theField.tabEnabled

Description

The Boolean tabEnabled property governs whether theField is part of the tab order for the text fields, movie clips, and buttons currently on screen. The tab order is the sequence in which objects are focused when the Tab key is pressed in a movie. Using the Tab key during text entry, a user can move between text fields in a form.

However, there are two distinct tab orders in a Flash movie: the automatic tab order and the custom tab order. The automatic tab order is Flash's default tab order, used when no custom tab order is defined. It includes all buttons and input text fields currently on screen and orders them from left to right, then top to bottom. Text fields with type set to "dynamic" are not included. The custom tab order is an ActionScript-defined tab order including an arbitrary sequence of Button, MovieClip, and TextField objects. To define a custom tab order, we set the tabIndex property for each button, movie clip, or text field we want included in the order. When at least one object currently on screen has a tabIndex property defined, the custom tab order is used.

For text fields, the tabEnabled property has two applications:

  • It can exclude an input text field with a defined tabIndex from the custom tab order.

  • It can exclude an input text field from the automatic tab order.

Neither scenario is particularly common because input text fields normally should be keyboard-accessible. To disable an input text field temporarily, we can simply set its type to "dynamic", which also removes it from the tab order.

Note that the behavior of tabEnabled depends on the value of the tabIndex property. For reference, Table 18-24 shows the results of the possible tabEnabled and tabIndex combinations for an input text field.

Table 18-24. Dependencies between tabEnabled and tabIndex for input text fields

tabEnabled

tabIndex

TextField included in custom tab order?

TextField included in automatic tab order?

true or undefined

undefined

no

yes

true or undefined

positive integer

yes

N/A

false

undefined

no

no

false

positive integer

no

N/A

A movie clip's tabChildren property affects the text fields, clips, and buttons it contains. To disable tabbing for a group of text fields, put them in a movie clip and set the clip's tabChildren property 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

The following code creates two text fields and excludes the second from the automatic tab order:

// Create the fields this.createTextField("field1_txt", 1, 40, 70, 100, 20); field1_txt.border = true; field1_txt.type = "input"; this.createTextField("field2_txt", 2, 150, 70, 100, 20); field2_txt.border = true; field2_txt.type = "input"; field2_txt.tabEnabled = false;

See Also

Button.tabEnabled, MovieClip.tabChildren, MovieClip.tabEnabled, TextField.tabIndex, TextField.type



    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