Flex 4: Scale to a point (zoom into an image where the mouse was clicked)

Posted by Jason W on Stack Overflow See other posts from Stack Overflow or by Jason W
Published on 2010-06-14T19:07:56Z Indexed on 2010/06/14 19:12 UTC
Read the original article Hit count: 176

Filed under:
|
|

I've been trying to get this working and I can't seem to figure it out. There is an Image control that when I click on it I need to zoom in (using the center/transform point where the mouse is clicked).

I have the zoom transition working great, but when I set transformX & tranformY (with autoCenterTransform false) it doesn't zoom into that point.

Here is my code that only zooms in (not to a specific point)

<fx:Script>
        <![CDATA[

            protected function imgLogo_clickHandler(event:MouseEvent):void
            {
                transformer.play();
            }           
        ]]>
    </fx:Script>

    <fx:Declarations>       
        <s:Parallel id="transformer" target="{imgLogo}">
            <s:Scale scaleXBy="0.5" scaleYBy="0.5" />           
        </s:Parallel>
    </fx:Declarations>

    <mx:Image id="imgLogo"   width="250" x="100" y="100"
            maintainAspectRatio="true" source="@Embed('src/logo.png')"      
            click="imgLogo_clickHandler(event)"  />

Any help is greatly appreciated. Thanks

© Stack Overflow or respective owner

Related posts about flex4

Related posts about scale