Orient

  
  

Using the Orient Gesture

Orient enables the ability for objects to “right” themselves based on a user’s finger-position.

Mechanics and Code Samples

To register an ‘orient’ event, the user places multiple fingers on an object, which will then realign itself based on the user’s touch point configuration.

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

1
myTouchSprite.gestureList = {"5-finger-orient":true};

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

2
myTouchSprite.addEventListener(GWGestureEvent.ORIENT, gestureOrientHandler);

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

3
4
5
6
private function gestureOrientHandler(event:GWGestureEvent):void
{
trace("g orient: ", event.value.dx, event.value.dy);
}

In this example, the x and y coordinate delta values of the Orient 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.