MovieClip设置以中心点旋转

来源:互联网 发布:java定义数组长度 编辑:程序博客网 时间:2024/05/26 02:19
  1. var transtimer:Timer=new Timer(50,150);
  2. transtimer.addEventListener("timer",timeChange);
  3. transtimer.addEventListener("timerComplete",timeComplete);
  4. var objMatrix3:Matrix=parMC.childMC.transform.matrix;
  5. var step:Number=Math.PI/2;
  6. var rX = parMC.width/2;
  7. var rY = parMC.height/2;
  8. transtimer.start();
  9. function childRotation():void 
  10. {
  11.         objMatrix3.tx-=rX;
  12.         objMatrix3.ty-=rY;
  13.         objMatrix3.rotate(step/100);
  14.         objMatrix3.tx+=rX;
  15.         objMatrix3.ty+=rY;
  16.         parMC.childMC.transform.matrix=objMatrix3;
  17. }
  18. function timeChange(event:TimerEvent):void 
  19. {
  20.         childRotation();
  21. }
  22. function timeComplete(event:TimerEvent):void 
  23. {
  24.         transtimer.reset();
  25.         transtimer.start();
  26. }
原创粉丝点击