home *** CD-ROM | disk | FTP | other *** search
- class com.neodelight.std.Flow
- {
- var mc;
- var queue;
- var p;
- function Flow()
- {
- _global.bin.syslog("Flow","()");
- var _loc4_ = _root.getNextHighestDepth();
- this.mc = _root.createEmptyMovieClip("flowMc" + _loc4_,_loc4_);
- this.queue = new Array();
- }
- function pushTask(onStep, o, params, times, exitFlag, exitVal)
- {
- if(!times && !exitFlag)
- {
- times = 1;
- }
- else if(times <= 0)
- {
- times = -1;
- }
- this.queue.push({o:o,onStep:onStep,p:params,exitTimes:times,exitFlag:exitFlag,exitVal:exitVal});
- this.mc.p = this;
- this.mc.onEnterFrame = function()
- {
- this.p.step();
- };
- }
- function step()
- {
- var _loc2_ = this.queue[0];
- var _loc3_ = _loc2_.onStep.apply(_loc2_.o,_loc2_.p);
- if(_loc2_.exitFlag && _loc2_.exitVal == _loc3_)
- {
- this.queue.shift();
- if(!this.queue.length)
- {
- delete this.mc.onEnterFrame;
- }
- return undefined;
- }
- if(_loc2_.exitTimes > 0)
- {
- if(!--_loc2_.exitTimes)
- {
- this.queue.shift();
- if(!this.queue.length)
- {
- delete this.mc.onEnterFrame;
- }
- }
- }
- }
- }
-