1 Reply Latest reply on May 13, 2010 7:22 AM by David_F57

    Simple zoom pan example

    vineet osho Level 1

      Hello Freinds i am working on image editing.and need to zoomIn Zoom Out the my image.I m following that link.

      http://www.adobe.com/devnet/flex/samples/fig_panzoom/

       

      but its quiet difficult to implement, and its to much advanced.i need simple zoom.but the main point is that i need to zoomin and zoom out particular part of an image.i mean to say any part of the image can be zoom in and zoom out.plz plz plz help me out,i m totally confused with this heavy code

       

       

      Thanks and regards

            Vineet Osho

        • 1. Re: Simple zoom pan example
          David_F57 Level 5

          hi

           

          this is about as simple as you can get it

           

          create a new project replace the code with this and add an image to your project for testing.

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

             xmlns:s="library://ns.adobe.com/flex/spark"

             xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

          <fx:Declarations>

          <!-- Place non-visual elements (e.g., services, value objects) here -->

          </fx:Declarations>

          <s:HGroup horizontalCenter="0" top="10">

          <s:Button label="zoom in" click="img.scaleX=img.scaleX+0.25;img.scaleY=img.scaleY+0.25"/>

          <s:Button label="zoom out" click="img.scaleX=img.scaleX-0.25;img.scaleY=img.scaleY-0.25"/>

          </s:HGroup>

          <s:Panel x="87" y="150" width="600" height="480" verticalCenter="0" horizontalCenter="0">

          <s:Group top="0" left="0" bottom="0" right="0" clipAndEnableScrolling="true">

          <mx:Image id="img" x="95" y="78" width="408" height="306" source="test.jpg"

            mouseDown="img.startDrag()" mouseUp="img.stopDrag()"/>

          </s:Group>

          </s:Panel>

          </s:Application>