使用图像和滚动条的多点触控缩放

时间:2014-04-24 15:23:05

标签: android ios image flex zoom

如何为图像添加多点触控缩放功能?

我的应用代码:

    <s:Scroller left="0" right="0" top="0" bottom="0">
    <s:Group> 
        <s:Image left="0" right="0" top="0" bottom="-11"
                 source="@Embed(source='plans/rera.jpg')"/> 
    </s:Group>        
</s:Scroller> 

1 个答案:

答案 0 :(得分:0)

为您的图片添加ID(在本例中为“img”)并添加以下ActionScript代码

    <s:Image id="img"
             left="0"
             right="0"
             top="0"
             bottom="-11"
             source="@Embed(source='plans/rera.jpg')" />

        

        private function addEventListenerImage() : void
        {
            // call this function e.g. onCreationComplete Event
            img.addEventListener(TransformGestureEvent.GESTURE_ZOOM, onZoomImg);
        }

        private function onZoomImg($event : TransformGestureEvent) : void
        {
            img.scaleX = $event.scaleX;
            img.scaleY = $event.scaleY;
        }