Table of Contents

Key.isToggled( ) Method Flash 5

check whether the Caps Lock, Num Lock, or Scroll Lock keys are activated
Key.isToggled(keycode)

Arguments

keycode

An integer keycode, usually the keycode of the Caps Lock key (20), Num Lock key (144), or Scroll Lock key (145). Can also be the key constant Key.CAPSLOCK.

Returns

A Boolean indicating whether the key specified by keycode is locked on (true) or off (false).

Description

The isToggled( ) method detects the state of the special Caps Lock, Num Lock, or Scroll Lock keys. Unlike other keys, these keys have a locked "on" state and an unlocked "off" state, indicating whether or not the feature they represent is active. The return value of isToggled( ) tells us if the specified key is locked or not. Though isToggled( ) accepts any keycode, the return value is useful only for special keys that support a toggle feature. For all other keycodes it returns false. To detect the state of other keys, use isDown( ). Note that getCode( ) or getAscii( ) detect the last key pressed, which may have been subsequently released, and therefore do not reflect the current state of a key.

See Also

Key.getAscii( ), Key.getCode( ), Key.isDown( ); Appendix B


Table of Contents