topical media & game development
lib-as-com-asinmotion-effects-Parallel.ax
lib-as-com-asinmotion-effects-Parallel.ax
(swf
)
[ flash
]
flex
package com.asinmotion.effects{
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.events.Event;
import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;
import flash.display.DisplayObject;
public dynamic class @ax-lib-as-com-asinmotion-effects-Parallel extends Array implements IEventDispatcher{
private var _delay:Number = 0;
private var _eventDispatcher:EventDispatcher;
public function @ax-lib-as-com-asinmotion-effects-Parallel():void{
_eventDispatcher = new EventDispatcher();
}
public function addEffect(effectObj:Object):void{
push(new Effect(effectObj))
}
public function start():void{
if(length > 0)forEach(setup);
}
private function setup(item:*, index:int, array:Array):void {
item.addEventListener('complete', cleanUp)
item.run();
}
internal function cleanUp(e:Event):void {
splice(indexOf(e.target),1)
if(length == 0){
dispatchEvent(new Event('complete'));
}
}
public function append(p:@ax-lib-as-com-asinmotion-effects-Parallel):void {
for each(var item in p){
push(item);
}
}
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void{
_eventDispatcher.addEventListener(type,listener,useCapture, priority, useWeakReference)
}
public function dispatchEvent(event:Event):Boolean{
return _eventDispatcher.dispatchEvent(event)
}
public function hasEventListener(type:String):Boolean{
return _eventDispatcher.hasEventListener(type)
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = true):void{
_eventDispatcher.removeEventListener(type, listener, useCapture)
}
public function willTrigger(type:String):Boolean{
return _eventDispatcher.willTrigger(type);
}
}
}
(C) Æliens
20/2/2008
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.