Rotate in multitouch does not work properly
Hello:
When I use the code below to rotate a image with multitouch screen I rotate but on a corner. Can anyone tell me how to rotate in the center of the image?
Thank you very much.
import flash.display.StageDisplayState;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Sprite;
import flash.events.TransformGestureEvent;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
/*stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
stage.scaleMode = StageScaleMode.NO_SCALE;*/
stage.align = StageAlign.TOP_LEFT;
var con:Sprite = new Sprite();
con.x = stage.stageWidth * .5;
con.y = stage.stageHeight * .5;
addChild(con);
var b:Sprite = Sprite(new f1()); // my image
b.x=-135;
b.y=-400;
b.addEventListener(TransformGestureEvent.GESTURE_ROTATE, onRotate);
con.addChild(b);
function onRotate(e:TransformGestureEvent):void
{
var b:Sprite = Sprite(e.currentTarget);
b.rotation += e.rotation;
}