• 3D旋转效果 舞台有个影片剪辑mc


    import flash.geom.Point;
    
    stage.addEventListener(MouseEvent.MOUSE_DOWN,mdHandler);
    stage.addEventListener(MouseEvent.MOUSE_UP,muHandler);
    stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
    
    var downPoint:Point=new Point;
    
    function mdHandler(e:MouseEvent):void
    {
    	stage.addEventListener(MouseEvent.MOUSE_MOVE,mmHandler);
    	//记录初始鼠标按下点
    	downPoint.x = mouseX;
    	downPoint.y = mouseY;
    }
    function mmHandler(e:MouseEvent):void
    {
    	//计算鼠标拖动到点的坐标和鼠标按下点之间的距离
    	//鼠标目前所在的点减去鼠标初始点返回一个新的点
    	/*	subtract()方法	 
    		public function subtract(v:Point):Point
    		从此点的坐标中减去另一个点的坐标以创建一个新点。
    		参数:v:Point — 要减去的点。
    		返回:Point — 新点。
    	*/
    	var temPoint:Point = new Point(mouseX,mouseY).subtract(downPoint);
    	trace(temPoint)
    	mc.rotationX +=  temPoint.y;
    	mc.rotationY -=  temPoint.x;
    	//再把这个点当初始点
    	downPoint.x = mouseX;
    	downPoint.y = mouseY;
    }
    //滚动鼠标滑轮事件
    function mouseWheelHandler(e:MouseEvent):void
    {
    	mc.z -=  e.delta * 10;
    }
    function muHandler(e:MouseEvent):void
    {
    	stage.removeEventListener(MouseEvent.MOUSE_MOVE,mmHandler);
    }
    
  • 相关阅读:
    最近总结
    公开MQTT服务器列表
    MQTT资料收集
    开源游戏
    B站学习资料
    MQTT资料
    都2020年了,还再问GET和POST的区别?【深度好文】
    以“用户登录”测试谈用例编写
    接口自动化测试框架9项必备功能
    一篇文章了解软件测试基础知识
  • 原文地址:https://www.cnblogs.com/602147629/p/1954104.html
Copyright © 2020-2023  润新知