强大的fl.transitions包,不用ENTER_FRAME就能让小球一直运动了

import fl.transitions.Tween;
import fl.transitions.TransitionManager;
import fl.transitions.Transition;
import fl.transitions.PixelDissolve;
import fl.transitions.easing.Strong;
import fl.transitions.easing.Regular;
import fl.transitions.TweenEvent;


ball.cacheAsBitmap=true;
var twTween:Tween=new Tween(ball,"x",Strong.easeOut,20,500,3,true);
twTween.addEventListener(TweenEvent.MOTION_FINISH,tweenFinishHandler);
var tmManager:TransitionManager=new TransitionManager(ball);

twTween.stop();
stage.addEventListener(MouseEvent.CLICK,stopTweenHandler);

tmManager.startTransition(
{type:PixelDissolve,
direction:Transition.IN,
duration:2,easing:Regular.easeOut,xSections:10,ySections:10});
function tweenFinishHandler(Event:TweenEvent):void {
	trace("ok");
	twTween.yoyo();
}

function stopTweenHandler(event:MouseEvent):void {
	twTween.start();
}
posted @ 2010-04-19 00:49  居家懒人  阅读(1347)  评论(0编辑  收藏  举报