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();
}