Double Tap

  
  

Using the Double Tap Gesture

Double Tap can be used to select items or provide a hierarchical selection structure when combined with other forms of Tap. Double Tap is used in the same context(s) as a ‘mouse double click’ event in a traditional user interface (UI).

Mechanics and Code Samples

To register a ‘double tap’ event, finger(s) must touch down on the screen and then be lifted up again and touch down again within a limited time period and within a limited spatial area on the touch screen surface. This ensures that the gesture registered is actually a ‘double tap’ and not unrelated touch events.

Enable the Double Tap gesture on a TouchSprite (“myTouchSprite” in this example) by adding the gesture to the gestureList property for the TouchSprite:

1
myTouchSprite.gestureList = {"double_tap":true};

Register an event for the gesture by listening for the ‘DOUBLE_TAP’ GWGestureEvent:

2
myTouchSprite.addEventListener(GWGestureEvent.DOUBLE_TAP, gestureDoubleTapHandler);

Finally, implement the script(s) that you want to respond to the event in a custom handler:

3
4
5
6
7
private function gestureDoubleTapHandler(event:GWGestureEvent):void
{
trace("g double tap (local): ", event.value.local.x, event.value.local.y);
trace("g double tap (stage): ", event.value.stage.x, event.value.stage.y);
}

In this example, the (local and stage/global) x and y coordinates of the Double Tap gesture are being sent to the Output window.

Gestures can be utilized with a number of touch points. For detailed information about this gesture and more, consult the GestureML Wiki.