• Flex 图片缩放、托拽效果



    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  
        layout
    ="absolute"     width="800" height="500" applicationComplete="app(event)" horizontalScrollPolicy="off" verticalScrollPolicy="off">
        
    <mx:Script>
            
    <![CDATA[
                import mx.controls.Alert;
                import mx.events.FlexEvent;
                protected function app(event:FlexEvent):void
                {
                img.addEventListener(MouseEvent.MOUSE_DOWN, imgMouseDown);
                img.addEventListener(MouseEvent.MOUSE_UP, imgMouseUp);
                this.addEventListener(MouseEvent.MOUSE_WHEEL, imgZoom);//滚动事件
                }
                private function imgMouseDown(evt:MouseEvent):void
                {
                    evt.currentTarget.startDrag();
                }
                private function imgMouseUp(evt:MouseEvent):void
                {
                    evt.currentTarget.stopDrag();
                }
                private function imgZoom(evt:MouseEvent):void
                {
                    var w:Number = img.width * evt.delta * 0.02;
                    var h:Number = img.height * evt.delta * 0.02;
                    img.x += -w/2;
                    img.y += -h/2;
                    
                    img.width += w;
                    img.height += h;
                    //Alert.show(img.width.toString());
                }
            
    ]]>
        
    </mx:Script>
        
    <mx:Image x="70" y="85" id="img" source="1.jpg"/>
    </mx:Application>
  • 相关阅读:
    Scala--基础
    maven
    Storm 运行例子
    Storm 安装部署
    Storm
    Kafka 集群部署
    Redis Twemproxy
    Redis Sentinel
    获取URL中参数的值
    浏览器滚动条样式
  • 原文地址:https://www.cnblogs.com/chixiaojin/p/2078320.html
Copyright © 2020-2023  润新知