I tried zoom in and out functionality for android mobile ,by using transformGestureEvent.GESTURE_ZOOM but it does not zooming properly ,because it's always zoom center point only not exact between two fingers within content (specific area).
I tried below 3 functions sample for zoom in and out
1. private function onZoom(e:TransformGestureEvent):void/* not working properly */
{
swfLoader.scaleX *= e.scaleX;
swfLoader.scaleY *= e.scaleY;
}
2. private function onZoom(e:TransformGestureEvent):void/* not working properly */
{
swfLoader.scaleX *= (e.scaleX+e.scaleY)/2;
swfLoader.scaleY *= (e.scaleX+e.scaleY)/2;
}3. private function onZoom(e:TransformGestureEvent):void
{
// scale the view
swfLoader.scaleX *= e.scaleX;
swfLoader.scaleY *= e.scaleY;
var bounds2:Rectangle = swfLoader.content.getBounds(swfLoader.stage);
var dx:Number = bounds2.x - bounds1.x;
var dy:Number = bounds2.y - bounds1.y;
var dw:Number = bounds2.width - bounds1.width;
var dh:Number = bounds2.height - bounds1.height;
// move the view to keep it centered while zooming
swfLoader.x -= dx + dw/2;
swfLoader.y -= dy + dh/2;
}<s:BorderContainer id="contentPanel" width="100%" height="100%" backgroundColor="#cccccc" >
<s:Scroller id="scroller" width="100%" height="100%" >
<s:VGroup id="swfloadergroup" width="100%" height="100%" horizontalAlign="center" verticalAlign="middle" >
<s:SWFLoader id="swfLoader" smoothBitmapContent="true" autoLoad="true" doubleClickEnabled="true"
maintainAspectRatio="true" gestureZoom="onZoom(event)" scaleContent="true" loadForCompatibility="true" />
<s:SWFLoader id="preLLoader" autoLoad="true" width="30%" height="30%"
source="@Embed('assets/loading.swf')"
maintainAspectRatio="true" scaleContent="true "/>
</s:VGroup>
</s:Scroller>
</s:BorderContainer>
So what did wrong in my code . how can i zoom exact content(specific area) between two fingers . if anybody know then Please let me know.