topical media & game development
#graphic-flex-image-effects-07-source-aeon-AnimationSequence.ax
#graphic-flex-image-effects-07-source-aeon-AnimationSequence.ax
[swf]
[flash]
flex
package aeon {
import aeon.events.AnimationEvent;
public class @ax-graphic-flex-image-effects-07-source-aeon-AnimationSequence extends Animation {
private var _animation:Animation;
private var _animations:Array;
private var _runningAnimations:Array;
public function @ax-graphic-flex-image-effects-07-source-aeon-AnimationSequence(animations:Array) {
_animations = animations;
}
private function onEndAnimation(event:AnimationEvent):void {
_animation.removeEventListener(AnimationEvent.END, onEndAnimation);
runAnimation();
}
private function runAnimation():void {
_animation = _runningAnimations.shift() as Animation;
if (_animation == null) {
stop();
dispatchEvent(new AnimationEvent(AnimationEvent.END));
} else {
_animation.addEventListener(AnimationEvent.END, onEndAnimation);
_animation.start();
}
}
override public function stop():void {
super.stop();
if (_animation) {
_animation.removeEventListener(AnimationEvent.END, onEndAnimation);
if (_animation.running) {
_animation.stop();
}
}
}
override public function start():void {
_runningAnimations = _animations.slice();
runAnimation();
super.start();
}
override public function die():void {
super.die();
_animations = null;
}
public function get animations():Array {
return _animations;
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.