Control (Key.control Property) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example creates a new listener object and defines a function for
The last line uses
addListener()
receive 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 displayed in the Output panel when you press the Caps Lock key. The Output
panel displays either
using the isToggled method.

CONTROL (Key.CONTROL property)

public static CONTROL : Number
The key code value for the Control key (17).
Availability: ActionScript 1.0; Flash Player 5
Example
The following example assigns the keyboard shortcut Control+7 to a button with an instance
name of
and makes information about the shortcut available to screen readers (see
my_btn
). In this example, when you press Control+7 the
_accProps
text
in the Output panel.
hello
function myOnPress() {
trace("hello");
}
function myOnKeyDown() {
// 55 is key code for 7
if (Key.isDown(Key.CONTROL) && Key.getCode() == 55) {
Selection.setFocus(my_btn);
my_btn.onPress();
}
}
var myListener:Object = new Object();
myListener.onKeyDown = myOnKeyDown;
Key.addListener(myListener);
my_btn.onPress = myOnPress;
my_btn._accProps.shortcut = "Ctrl+7";
Accessibility.updateProperties();
674
ActionScript classes
to register the listener with the Key object so that it can
or
, depending on whether the Caps Lock key is activated
true
false
onKeyDown
function displays the
myOnPress
.

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF