Triple Tap


Using the Triple Tap Gesture

Triple Tap can be used to select items or provide a hierarchical selection structure when combined with other forms of Tap.

Mechanics and Code Samples

To register a ‘triple tap’ event, finger(s) must touch down on the screen and then be lifted up again three times 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 ‘triple tap’ and not unrelated touch events.

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

myTouchSprite.gestureList = {"triple_tap":true};

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

myTouchSprite.addEventListener(GWGestureEvent.TRIPLE_TAP, gestureTripleTapHandler);

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

private function gestureTripleTapHandler(event:GWGestureEvent):void
trace("g triple tap (local): ", event.value.local.x, event.value.local.y);
trace("g triple tap (stage): ", event.value.stage.x, event.value.stage.y);

In this example, the (local and stage/global) x and y coordinates of the Triple 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.