MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 298

Actionscript language reference
Table of Contents

Advertisement

};
Key.addListener(keyListener);
Key.CAPSLOCK
Availability
Flash Player 5.
Usage
Key.CAPSLOCK:Number
Description
Property; constant associated with the key code value for the Caps Lock key (20).
Example
The following example creates a new listener object and defines a function for
last line uses
addListener()
notification from the key down event.
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.CAPSLOCK)) {
trace("you pressed the Caps Lock key.");
trace("\tCaps Lock == "+Key.isToggled(Key.CAPSLOCK));
}
};
Key.addListener(keyListener);
Information is written to the log file when you press the Caps Lock key. The log file writes either
or
, depending on whether the Caps Lock is activated using the isToggled method.
true
false
Key.CONTROL
Availability
Flash Player 5.
Usage
Key.CONTROL:Number
Description
Property; constant associated with the key code value for the Control key (17).
Example
The following example assigns the keyboard shortcut Control+7 to a button with an instance
name of
my_btn
). In this example, when you press Control+7 the
_accProps
"hello" to the log file.
function myOnPress() {
trace("hello");
298
Chapter 6: ActionScript Core Classes
to register the listener with the Key object so that it can receive
and makes information about the shortcut available to screen readers (see
onKeyDown
function writes the text
myOnPress
. The

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents