Rotation is performed by holding two fingers at different points on an object, and then moving one finger around the other in a clockwise or counter clockwise motion. This results in the rotation of the object on screen. Rotation can be used alongside the pan and zoom gestures to provide full control to the user over an image or other DisplayObject
.
This example draws a square within a Shape
object using the Graphics
API, adds it to the Stage
, and then sets up a listener for Rotate
gesture events in order to appropriately rotate the Shape
instance around its registration point:
1. First, import the following classes into your project:
import flash.display.StageScaleMode; import flash.display.StageAlign; import flash.display.Stage; import flash.display.Sprite; import flash.display.Shape; import flash.events.TransformGestureEvent; import flash.ui.Multitouch; import flash.ui.MultitouchInputMode;
2. Declare a
Shape
object which we will...