Name

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

Availability

Flash 5

Synopsis

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). May also be the key constant Key.CapsLock.

Returns

A Boolean indicating whether the key specified by keycode is 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 an “on” state and an “off” state indicating whether or not the feature they represent is active. The return of isToggled( ) tells us if the key’s feature is in effect or not. (Though isToggled( ) actually works for any keycode, its return value is useful only for special keys that support a toggle feature. To detect the state of other keys, use isDown( ), getCode( ), or getAscii( ).)

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.