我有以下代码
TransitionManager.start(babyPreloader,{type:Fade, direction:Transition.OUT, duration:0.5, easing:Regular.easeOut});
var tempPreloader:DisplayObject = babyPreloader as DisplayObject;
this.removeChild(tempPreloader);
但是,因为这不等待过渡完成。我看不到转变的发生。有没有办法让过渡完整的听众?
答案 0 :(得分:1)
这样可行。
var ts:TransitionManager = new TransitionManager(root_Mc);
fl_doTransition();
function fl_doTransition():void
{
ts.addEventListener("allTransitionsInDone", done);
ts.startTransition({type:Blinds, direction:Transition.IN, duration:0.25});
//OR in case you are using Transition.OUT
//ts.addEventListener("allTransitionsOutDone", done);
//ts.startTransition({type:Blinds, direction:Transition.OUT, duration:0.25});
}
function done(e:Event):void
{
trace( "yay!!");
}
答案 1 :(得分:-2)
例如使用TweenMax:
TweenMax.to(babyPreloader, 0.5, {alpha:0, onComplete:done});
...
private function done():void
{
removeChild(babyPreloader);
}