2 Replies Latest reply on Feb 17, 2010 11:35 PM by magortdsfg

    Zoom function on picture

    magortdsfg

      Hi,

       

      Does anyone of you know a good tutorial on how to implement zoom on a picture in a movieclip frame? I would like to do it with AC3 if possible?

       

      Thanks,

      MH

        • 1. Re: Zoom function on picture
          Ned Murphy Adobe Community Professional & MVP

          You can try searching Google using "AS3 Zoom" and you may find a tutorial or discussions.  What you do is use tweens to gradually change the size of an object.  If you put a movieclip on your stage and give it an instance name of "mc", the following AS3 code will zoom it 200% when you rollover it.

           

          import fl.transitions.Tween;
          import fl.transitions.easing.*;

           

          var twX:Tween;
          var twY:Tween;

           

          mc.addEventListener(MouseEvent.ROLL_OVER, zoomIn);
          mc.addEventListener(MouseEvent.ROLL_OUT, zoomOut);

           

          function zoomIn(evt:MouseEvent):void {
          twX = new Tween(mc, "scaleX", Regular.easeIn, mc.scaleX, 2, .5, true);
          twY = new Tween(mc, "scaleY", Regular.easeIn, mc.scaleY, 2, .5, true);
          }

           

          function zoomOut(evt:MouseEvent):void {
          twX = new Tween(mc, "scaleX", Regular.easeIn, mc.scaleX, 1, .5, true);
          twY = new Tween(mc, "scaleY", Regular.easeIn, mc.scaleY, 1, .5, true);
          }

          • 2. Re: Zoom function on picture
            magortdsfg Level 1

            Thanks, I'll try that!

             

            2010/2/17 Ned Murphy <forums@adobe.com>:

            You can try searching Google using "AS3 Zoom" and you may find a tutorial or discussions.  What you do is use tweens to gradually change the size of an object.  If you put a movieclip on your stage and give it an instance name of "mc", the following AS3 code will zoom it 200% when you rollover it.

            >

            import fl.transitions.Tween;

            import fl.transitions.easing.*;

            >

            var twX:Tween;

            var twY:Tween;

            >

            mc.addEventListener(MouseEvent.ROLL_OVER, zoomIn);

            mc.addEventListener(MouseEvent.ROLL_OUT, zoomOut);

            >

            function zoomIn(evt:MouseEvent):void {

             twX = new Tween(mc, "scaleX", Regular.easeIn, mc.scaleX, 2, .5, true);

             twY = new Tween(mc, "scaleY", Regular.easeIn, mc.scaleY, 2, .5, true);

            }

            >

            function zoomOut(evt:MouseEvent):void {

             twX = new Tween(mc, "scaleX", Regular.easeIn, mc.scaleX, 1, .5, true);

             twY = new Tween(mc, "scaleY", Regular.easeIn, mc.scaleY, 1, .5, true);

            }

            >