Using the Hold Gesture

Hold returns the horizontal and vertical position of multiple points when a user touches a multitouch surface over an extended period of time.

Mechanics and Code Samples

To register a ‘hold’ event, finger(s) must touch down on the screen and then remain there for a period of time.

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

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

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

myTouchSprite.addEventListener(GWGestureEvent.HOLD, gestureHoldHandler);

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

private function gestureHoldHandler(event:GWGestureEvent):void
trace("g hold: (local)", event.value.local.x, event.value.local.y);
trace("g hold: (stage)", event.value.stage.x, event.value.stage.y);

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