当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > 如何将角度和坐标标准化

Flash动画制作
Flash的事件机制:从AsBroadcaster到EventDispatcher
Flash脚本的执行顺序
完全掌握AS中点(.)语法的应用
抗日Flash集之:万里长城永不倒
抗日Flash集之:地道战
抗日Flash集之:抗日新闻
抗日Flash集之:三一八惨案
抗日Flash集之:五四运动
抗日Flash集之:抗日一隅
抗日Flash集之:血染的风采
抗日Flash集之:淞沪抗战
抗日Flash集之:终日到底
抗日Flash集之:东京功略战[游戏]
抗日Flash集之:大中华·1937
抗日Flash集之:长征
抗日Flash集之:抗日宣言
抗日Flash集之:血战钓鱼岛
用Flash MX制作MOV短片
用flash打开本地文件夹
Flash打造迷你特色音乐播放器

Flash动画制作 中的 如何将角度和坐标标准化


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 64 ::
收藏到网摘: n/a

如何将角度和坐标标准化

_root.createEmptyMovieClip("line", 0);
//建立一个空的电影剪辑
_root.onEnterFrame = function() {
   mc._x = _xmouse;
   mc._y = _ymouse;
   //定义MC的坐标为鼠标的坐标
   x = _xmouse-100;
   y = -(_ymouse-100);
   //这里用负的是将FLASH的坐标换回一般的坐标
   //这里就是将坐标中心移到了中心(舞台是200*200)
   with (_root.line) {
      clear();
      lineStyle(1);
      moveTo(100, 100);
      lineTo(_xmouse, _ymouse);
      lineTo(_xmouse, 100);
      //动态画线
   }
   m = Math.atan2(y, x);
   //这里是返回角的弧度
   r = (m*180)/Math.PI;
   //这里返回角度
   if (r<0) {
      r = r+360;
      //这里将角度化为在0--360之间
   }
   angle = "角度="+Math.round(r);
   n = "x="+x+"y="+y;
   //返回舞台的文本框
};

"