Using the Flick Gesture
Flick returns max velocity values for vertical and horizontal elements of the flick gesture.
Mechanics and Code Samples
To register a ‘flick’ event, a finger must touch down on the screen and then slid rapidly in another direction while the finger is removed.
Enable the Flick gesture on a TouchSprite ("myTouchSprite" in this example) by adding the gesture to the gestureList property for the TouchSprite:
1 | myTouchSprite.gestureList = {"n-flick":true}; |
Register an event for the gesture by listening for the 'FLICK' GWGestureEvent:
2 | myTouchSprite.addEventListener(GWGestureEvent.FLICK, gestureFlickHandler); |
Finally, implement the script(s) that you want to respond to the event in a custom handler:
3 4 5 6 | private function gestureFlickHandler(event:GWGestureEvent):void { trace("g flick: ", event.value.dx, event.value.dy, event.value.ddx, event.value.ddy); } |
In this example, the x coordinate delta value, as well as acceleration values, of the Drag 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.