繁体   English   中英

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

[英]Using multitouch zoom with image and scroller

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

我的应用程式码:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM