Skip navigation
Currently Being Moderated

A few questions about Pinch Zooms in Flash CS6.

May 30, 2013 6:18 AM

Tags: #flash #ios #actionscript #flash_professional #actions #cs6

I'm a novice creating my first app using Flash CS6 and have a few questions.

Is there a way to limit the size of your pinch zoom?

And to get it to zoom in where you press not just the centre?


Many Thanks


  • Currently Being Moderated
    Jun 3, 2013 8:40 AM   in reply to JoshBurgess

    assuming you have a MovieClip mc on stage with the registrationpoint in the center:


    stage.addEventListener(MouseEvent.CLICK, zoomHandler);

    var currentZoom:Number = 1;

    var zoomFactor:Number = 1.1;

    var maxZoom:Number = 2;


    function zoomHandler(e:MouseEvent):void{

        var zoomCenter:Point = new Point(e.stageX, e.stageY);

        var mcCenter:Point = new Point(mc.x, mc.y);

        var _xCorrection:Number = mcCenter.x-zoomCenter.x;

        var _yCorrection:Number = mcCenter.y-zoomCenter.y;

    currentZoom +=zoomFactor-1;


        mc.scaleX +=zoomFactor-1;

        mc.scaleY +=zoomFactor-1;

        mc.x -=_xCorrection*zoomFactor*.5;

        mc.y -=_yCorrection*zoomFactor*.5;



    trace("maximal zoom level reached");



    Mark as:
  • Currently Being Moderated
    Jun 14, 2013 12:29 AM   in reply to JoshBurgess

    what didn`t work? didn`t zoom it at all? Did you get any errors? I tested this code so I´m sure its flawless.

    Mark as:
  • Currently Being Moderated
    Jun 14, 2013 6:36 AM   in reply to JoshBurgess

    Have you changed all the mousevents to touchevents?

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points