Two Finger Zoom

The ‘two finger zoom’ event allows the user to zoom in or out on an object using two fingers. The ‘two finger zoom’ gesture calculates the change in position for two fingers, averages the change, and returns a value that is the difference between the fingers’ current position and their last position.
Using the Two Finger Zoom Gesture
The ‘two finger zoom’ gesture is typically used to zoom in or zoom out on an element.
Mechanics and Code Samples
To register a ‘two finger zoom’, place one finger of each hand on the surface and draw them apart or together to scale an element on the surface accordingly.
1 2 3 4 5 | element.addEventListener(GestureEvent.GESTURE_SCALE); function (event:GestureEvent):void; { element.scaleX+=event.value; element.scaleY+=event.value; } |
Parameters
All touch and gesture events have a localX and localY (relative) position as well as a stageX and stageY (absolute) position.
In addition, the ‘two finger zoom’ gesture requires that the distance between the current and last position is divided by a variable that acts to normalize the percentage rate of change.
Related Gestures
Associated Tutorials
How To Create A Google Maps application with move, double-tap, rotate, scale and tilt
