Flash 8 Documentation |
|||
| Using Flash > Creating Accessible Content > Using Flash to enter accessibility information for screen readers > Specifying advanced accessibility options for screen readers > Creating a keyboard shortcut | |||
You can create a keyboard shortcut for an object, such as a button, so users can quickly navigate to it without listening to the contents of an entire page. For example, you can create a keyboard shortcut so users can quickly navigate to a menu, a toolbar, the next page, or a submit button.
Two steps are required to create a keyboard shortcut:
If you provide a keyboard shortcut for an input text field or button, you must also use the ActionScript Key class to detect the key the user presses during Flash content playback. See Capturing keypresses in Learning ActionScript 2.0 in Flash.Keyboard shortcut functionality also depends on the screen reader software used. Make sure to test your Flash content with multiple screen readers. The key combination Control+F, for example, is a reserved keystroke for both the browser and the screen reader. The arrow keys are also reserved by the screen reader. Generally, you can use the keys 0-9 on the keyboard for keyboard shortcuts. However, even these keys are increasingly used by screen readers, so it is very important to test your keyboard shortcuts. See Testing accessible content.
|
WARNING |
|
Flash does not check that the ActionScript to code the keyboard shortcut has been created. |
To create a keyboard shortcut, Control+7, for a button with the instance name myButton, you would do the following:
function myOnPress() {
trace( "hello" );
}
function myOnKeyDown() {
if (Key.isDown(Key.CONTROL) && Key.getCode() == 55) // 55 is key code for 7
{
Selection.setFocus( myButton );
myButton.onPress();
}
}
var myListener = new Object();
myListener.onKeyDown = myOnKeyDown;
Key.addListener( myListener );
myButton.onPress = myOnPress;
myButton._accProps.shortcut = "Ctrl+7"
Accessibility.updateProperties();
|
NOTE |
|
The example assigns the keyboard shortcut Control+7 to a button with an instance name of myButton and makes information about the shortcut available to screen readers. In this example, when you press Control+7 the |
Version 8
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00000890.html