Using the Tilt Gesture

Tilt allows an object to be rotated around a precise, user-determined axis.

Mechanics and Code Samples

To register a ‘tilt’ event, two fingers from one of a user's hands needs to be placed on an object; this functions as the rotation axis center. Using their other hand, the user places a finger on the object and slides. This initializes the tilt.

Enable the Tilt gesture on a TouchSprite ("myTouchSprite" in this example) by adding the gesture to the gestureList property for the TouchSprite:

myTouchSprite.gestureList = {"3-finger-tilt":true};

Register an event for the gesture by listening for the 'TILT' GWGestureEvent:

myTouchSprite.addEventListener(GWGestureEvent.TILT, gestureTiltHandler);

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

private function gestureTiltHandler(event:GWGestureEvent):void
    trace("g tilt: ", event.value.dx);

In this example, the x coordinate delta value of the Tilt gesture is 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.