Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Adobe Flash

  • Print
  • + Share This

Keyboard events

A keyboard event occurs when the user presses a letter, a number, a punctuation mark, a symbol, an arrow, the Backspace, the Insert, the Home, the End, the Page Up, or the Page Down keys. Keyboard events are case sensitive, which means that A is not the same as a. So, if you assign A to trigger an action, a will not trigger it.

Keyboard events are attached to button instances. Although you don't need to interact with the button instance, it must be present in a scene for the keyboard event to work (though it doesn't need to be visible or even present on the stage). It can even reside in the work area of the frame so that it is not visible when the movie is exported (Figure 5).

Figure 5

Hide buttons that contain keyboard events in areas that will not be seen when the final movie is exported—for example, outside the stage area.

To define a keyboard event that triggers an action:

  1. Perform Steps 1 through 5 for adding a mouse event.

  2. On the Parameter pane of the Action dialog box, check the key-press event.

  3. In the small text box next to the key-press option, type the key that will trigger the action (Figure 6).

    Figure 6

    Press a key on the keyboard to set the key that triggers an action.

  4. Click OK.

    When the movie is played, the action you assigned this button instance will be performed when the user presses the key you picked.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.