dispatchEvent(new Event(Event.MOVIE_COMPLETED));
}
advanceTime(carryOverTime);
}
下面列出Juggler中所有可用的API:
∗>
}
// this API will be called from outside
// stop calling it will pause the content played by this Juggler in this sprite (BattleScene)
public function advanceTime ( time:Number ):void
{
juggler.advanceTime( time );
}
public override function dispose():void
{
juggler.purge();
super.dispose();
}
}
}
好了,当外部想要激活此面板时,只需要侦听EnterFrameEvent.EVENT事件并在事件侦
听器中,以EnterFrameEvent事件对象的passedTime属性作为参数调用此面板对象的
advanceTime方法即可。
private function onFrame(event:EnterFrameEvent):void
{
if ( paused )
battle.advanceTime( event.passedTime );
}
当游戏被暂停后,我们需要停止每帧对advanceTime方法的调用,这样就可以停止战场模
块的动画内容播放。当然,如果此时我们需要让菜单面板弹出并播放此面板中的动画,只需
要添加如下几句:
private function onFrame(event:EnterFrameEvent):void
{
if ( paused )
alertBox.advanceTime ( event.passedTime );
else battle.advanceTime( event.passedTime );
dashboard.advanceTime ( event.passedTime );
}