Flash Builder Keyboard Hold Key Down

Tag: events , keyboard , flash-builder , switch-statement Author: abel_1802 Date: 2013-12-28

I am making a story telling app in Flash Builder for iPad. I'm looking to make my application accessible from a 2-button switch, even though there are three options on the screen.

  1. The first onscreen option is to move forward through the story.
  2. The second onscreen option is to move backward through the story.
  3. The third onscreen option is to highlight the current part of the story as something the user is worried about.

I already have the application using the first button on the switch to move forward through the story, and the second button to move backwards through the story. I was wondering if there is some way to have a user hold down either of the buttons for a few seconds in order to activate the third option, and highlight the current part of the story as something they are worried about.

I've looked but am finding it difficult to find information on any sort of a hold option on a keypress. I don't want to use double tap, as the users I am working with have severe physical disabilities, and some cannot perform a double tap.

The following is the code I have so far for the key presses:

addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function myKeyDown(e:KeyboardEvent):void
{
    if (e.keyCode == Keyboard.N)
    {
        moveOn();
    }
    if (e.keyCode == Keyboard.P)
    {
        moveBack();
    }
}

Any help is appreciated!