• 关于AIR多点触控开发<基础篇>


    目录:

    关于flash多点触控开发<基础篇>

    关于flash多点触控开发-交通 <案例篇>

    此专题目的:开发支持多点触控的地图案例。仅仅作为进度笔记

    import flash.events.TransformGestureEvent;
     
    import flash.events.TouchEvent;
    import flash.text.TextField;
     
     
    var pointA_id:Number=0;
    var pointB_id:Number=0;
     
    addEventListener(TouchEvent.TOUCH_BEGIN, onTouchBegin);
    addEventListener(TouchEvent.TOUCH_END, onTouchEnd);
    addEventListener(TouchEvent.TOUCH_MOVE, onTouchMove);
     
    addEventListener(TransformGestureEvent.GESTURE_ROTATE,onRotate)
    addEventListener(TransformGestureEvent.GESTURE_ZOOM,onZoom)
    addEventListener(TransformGestureEvent.GESTURE_PAN,onPan)
    addEventListener(TransformGestureEvent.GESTURE_SWIPE,onSwipe)
     
     
    function onRotate(e:TransformGestureEvent):void{
     _txt.text="rotate:"+e.rotation
     container.rotation+=e.rotation
      
    }
     
    function onZoom(e:TransformGestureEvent):void{
     _txt.text="scaleX:"+e.scaleX+"\n"+"scaleY:"+e.scaleY;
     if(e.scaleX==0 && e.scaleY==0)return;
      
     var scale:Number=(e.scaleX>=e.scaleY) ? e.scaleX : e.scaleY;
     scale=fixNumber(scale)
      
     var minS:Number=0.2;
     var maxS:Number=1;
      
     var tempScale=fixNumber(container.photo_mc.scaleX)*scale;
     tempScale=fixNumber(tempScale)
      
     if(tempScale<minS) tempScale=minS;
     if(tempScale>maxS) tempScale=maxS;
      
     container.photo_mc.scaleX=container.photo_mc.scaleY=tempScale;
      
    }
     
    function onPan(e:TransformGestureEvent):void{
     _txt.text="offsetX:"+e.offsetX+"\n"+"offsetY:"+e.offsetY;
     container.x+=e.offsetX;
     container.y+=e.offsetY;
    }
     
    function onSwipe(e:TransformGestureEvent):void{
     //trace("SWIPE")
    }
     
    function onTouchBegin(e:TouchEvent):void{
      
     if(pointA_id==0){
      pointA_id=e.touchPointID
      updatePointInfo(e.touchPointID,e.stageX,e.stageY,a_txt)
     }else{
      pointB_id=e.touchPointID
      updatePointInfo(e.touchPointID,e.stageX,e.stageY,b_txt)
     }
    }
     
    function onTouchMove(e:TouchEvent):void{
     if(pointA_id==e.touchPointID){
      updatePointInfo(e.touchPointID,e.stageX,e.stageY,a_txt)
     }else{
      updatePointInfo(e.touchPointID,e.stageX,e.stageY,b_txt)
     }
      
    }
    function onTouchEnd(e:TouchEvent):void{
     if(pointA_id==e.touchPointID){
      pointA_id=0;
      clearPointInfo(a_txt)
     }else{
      pointB_id=0
      clearPointInfo(b_txt)
     }
      
    }
     
    function updatePointInfo(id:Number,x:Number,y:Number,_txt:TextField):void{
     var str:String="";
     str="PointID: "+id+"\n";
     str+="X: "+x+"\n";
     str+="Y: "+y;
     _txt.text=str;
    }
     
    function clearPointInfo(_txt:TextField):void{
     _txt.text="PointID: --\n"+"X: --\n"+"Y: --";
    }
    function fixNumber(n:Number):Number{
     return int(n*100)/100;
    }
  • 相关阅读:
    绕过验证码登陆的方法(适合只需登陆一次可以记住登陆台的网站)
    Throughput Controller(吞吐量控制器) 感觉就像个线程控制器来的
    时间戳 和 日期 转换的方法 (含获取当前时间戳的方法)
    pip使用笔记
    可以模拟多种浏览器的网站
    浏览器兼容性说明
    测试套件的使用
    python 时间对比大小 和 间隔多少天
    django数据库操作
    mysql连接工具记录
  • 原文地址:https://www.cnblogs.com/bulolo/p/3087382.html
Copyright © 2020-2023  润新知