I'm having problems finding the exact answer I'm looking for. I'm building an application that currently allows pinch zooming on an image. This is being built in Flash Builder 4.5. What I want specifically is to keep the image the same dimensions while zooming in and out. So the image still increases and decreases but stays within an invisible box.
Does that explanation make sense?
Right now I can zoom in and out but it changes the image size and covers the other content. Eventually other features will be added including pan and rotate. The image will become a 3D model of a mouth.
If tutorials or sources are supplied that would be great.
Here's my code for the zoom gesture which is using the TransformGestureEvent:
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.TransformGestureEvent;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
private function init():void
{
img.addEventListener(TransformGestureEvent.GESTURE_ZOOM, onZoom);
}
private function onZoom(event:TransformGestureEvent):void
{
var mySprite:Sprite = img as Sprite;
if(mySprite.scaleY.valueOf() >= 1)
{
mySprite.scaleX *= event.scaleX;
mySprite.scaleY *= event.scaleY;
}
else
{
mySprite.scaleX= 1;
mySprite.scaleY = 1;
}
}