2011年4月12日

用AS3讓物件旋轉45度之後重複Tween

import fl.transitions.Tween;
import fl.transitions.easing.*;

//讓box物件在1秒鐘之內從0度旋轉45度
var myTween=new Tween(box,"rotation",None.easeInOut,0,45,1,true);

//如果旋轉到45度了就重複再做一次
function loopTween(e:Event):void {
 if(box.rotation == 45){
  var myTween=new Tween(box,"rotation",None.easeInOut,0,45,1,true);
 }
}
box.addEventListener(Event.ENTER_FRAME, loopTween);

沒有留言:

張貼留言