6 Replies Latest reply on Jun 7, 2009 9:04 AM by Eli7BBB

    Zooming in flex and the originX originY role

    Eli7BBB

      Hi

       

      I have an image. It's source comes from fla, and is a movie clip with children nested in it.

      I am assigning an eventlistener so when I click on one of the nested movie clips, I want to zoom where I clicked.

       

      I tried using the example source code which demonstrate zooming:

       

       

       

       

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

      <mx:Application

       

      xmlns:mx=http://www.adobe.com/2006/mxml backgroundAlpha="0">

       

       

       

       

       

       

      <mx:Zoom

       

      id="zoomIn" zoomWidthTo="1" zoomHeightTo="1" />

      <mx:Zoom

       

      id="zoomOut" zoomWidthTo=".5" zoomHeightTo=".5" />

       

       

      <mx:Panel

       

      title="Zoom Demo" width="100%" height="100%" horizontalAlign="center">

       

      <mx:Label

       

      text="Mouse over the image to enlarge it"/>

       

      <mx:Canvas

       

      id="canvas" width="100%" height="100%">

       

       

       

       

       

       

       

      <mx:Image id="img" x="{canvas.width/2 - img.width/2}" y="{canvas.height/2 - img.height/2}"

      source="@Embed('../assets/some_jpg_file.jpg')" scaleX=".5" scaleY=".5"

      rollOverEffect="

      zoomIn" rollOutEffect="zoomOut"/>

       

       

       

      </mx:Canvas>

       

      </mx:Panel>

       

      </mx:Application>

       

       

      This works OK but zooms from the center. I thought if I change the originX originY parametes to the x,y location of where I clicked, I will

      be able to zoom to that point. But that does not work correctly.

      Has any one used the originX originY parametes before ???

       

      Thanks

       

      Elisheva