23.5. Making Keyboard-Navigable Movies

Problem

You want to create keyboard shortcuts that duplicate button behaviors, and you want to expose those shortcuts to assistive devices.

Solution

Create keyboard shortcuts that duplicate button actions, using Key.isDown( ). Write code in a modular way, so that it can be accessed in more than one way. Use the Accessibility panel to inform users with assistive devices about the keyboard shortcuts. Specify a logical tab order for buttons, using tabIndex.

Discussion

Movies that rely on buttons to control playback intrinsically rely on users’ ability to click on those buttons with a mouse. One way to make movies functional for those who rely on the keyboard is to create keyboard shortcuts. Buttons can be made accessible in one of two ways:

Default keyboard shortcuts

By default, users can execute button actions by setting the focus on the button and pressing Enter or Return. A disadvantage to this approach is that users must tab to the button, which could become unwieldy in a movie with many buttons. A related issue is tab order.

Custom keyboard shortcuts

The developer creates keyboard shortcuts for certain actions. For example, pressing S stops a movie, while pressing P causes it to start playing again. These require a modest amount of extra work but are generally worth it.

These two approaches to button accessibility are not exclusive, and even when you implement custom keyboard shortcuts, default keyboard shortcuts will still be in place.

If you are ...

Get Flash 8 Cookbook 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.