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



如何为图像添加多点触摸缩放?

我的应用程序代码:

    <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> 

将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;
        }

最新更新