Pinch Zoom

The ‘pinch zoom’ gesture allows the user to zoom in or out on an object using a pinching motion with two fingers, usually the thumb and forefinger. The ‘pinch zoom’ gesture calculates the change in position for each finger and returns a value that is the difference between the fingers’ current position & their last position.
Using the Pinch Zoom Gesture
The ‘pinch zoom’ gesture is typically used to zoom in or zoom out on an element.
Mechanics and Code Samples
To register a ‘pinch zoom’, start with two fingers (usually thumb and forefinger) and move them either apart or together in a linear motion to change the scale of 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 ‘pinch zoom’ gesture requires that the distance between the current and last position be divided by a variable that acts to normalize the percentage rate of change.
Related Gestures
Two Finger Zoom, Multi-point Zoom
Associated Tutorials
How To Create A Google Maps application with move, double-tap, rotate, scale and tilt
