Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7536261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:31:32+00:00 2026-05-30T06:31:32+00:00

I tried zoom in and out functionality for android mobile ,by using transformGestureEvent.GESTURE_ZOOM but

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:31:34+00:00Added an answer on May 30, 2026 at 6:31 am

    TransformGestureEvent has localX and localY properties which contain coorinates of the center between two fingers.

    Though you can’t zoom an object from a non-center point without moving it so only by zooming gestures you can move even a ‘stationary’ one. To make the gesture look natural first you need to move your sprite by the difference between positions and then zoom it from specific point.

    You will need oldLocalX and oldLocalY to keep old coordinates. Set these vars to current localX/localY when gesture.phase == GesturePhase.BEGIN. After that move your sprite by new delta.

    To zoom an object from a specific point do the following:

    var matrix:Matrix = this.transform.matrix;
    matrix.translate(-event.localX, -event.localY);
    matrix.scale(event.scaleX, event.scaleY);
    matrix.translate(event.localX, event.localY);
    this.transform.matrix = matrix;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using glScale() to zoom out whole game scene. But at some scales
i am using the camera.setSmoothZoom(i) function of the Camera class but its not helping
My jquery mobile page is WAY to zoomed out. I have tried everything I
I am trying to implement multi touch zoom in and zoom out functionality to
JCrop it is a really great plugin but unfortunately lack of Zoom-In Zoom-Out feature.
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried a bunch of things but I can't get it to work consistently amid
tried to find the answer by googling and in MSDN but with no luck.
Tried examples from 'php.net' but don't understand what's the problem. Any suggestions? <?php $_SESSION['test']
Tried to install some program, it gives above message requiring 1.1.4322. BUT as the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.