User Guide
Key.CONTROL 347
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 and makes information about the shortcut available to screen readers (see
_accProps). In this example, when you press Control+7 the
myOnPress function displays the text
hello in the Output panel.
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();