zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    hive on hbase
    django多表操作
    django单表操作
    django模板
    django路由初识
    python 相关模块安装 国内镜像地址
    django初识
    Python中属性和描述符的简单使用
    pip安装包(python安装gevent(win))
    jQuery 事件方法
  • 原文地址:https://www.cnblogs.com/chixiaojin/p/2078320.html
Copyright © 2011-2022 走看看