home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / alex_trax.swf / scripts / __Packages / com / neodelight / std / Flow.as < prev    next >
Encoding:
Text File  |  2007-10-01  |  1.3 KB  |  56 lines

  1. class com.neodelight.std.Flow
  2. {
  3.    var mc;
  4.    var queue;
  5.    var p;
  6.    function Flow()
  7.    {
  8.       _global.bin.syslog("Flow","()");
  9.       var _loc4_ = _root.getNextHighestDepth();
  10.       this.mc = _root.createEmptyMovieClip("flowMc" + _loc4_,_loc4_);
  11.       this.queue = new Array();
  12.    }
  13.    function pushTask(onStep, o, params, times, exitFlag, exitVal)
  14.    {
  15.       if(!times && !exitFlag)
  16.       {
  17.          times = 1;
  18.       }
  19.       else if(times <= 0)
  20.       {
  21.          times = -1;
  22.       }
  23.       this.queue.push({o:o,onStep:onStep,p:params,exitTimes:times,exitFlag:exitFlag,exitVal:exitVal});
  24.       this.mc.p = this;
  25.       this.mc.onEnterFrame = function()
  26.       {
  27.          this.p.step();
  28.       };
  29.    }
  30.    function step()
  31.    {
  32.       var _loc2_ = this.queue[0];
  33.       var _loc3_ = _loc2_.onStep.apply(_loc2_.o,_loc2_.p);
  34.       if(_loc2_.exitFlag && _loc2_.exitVal == _loc3_)
  35.       {
  36.          this.queue.shift();
  37.          if(!this.queue.length)
  38.          {
  39.             delete this.mc.onEnterFrame;
  40.          }
  41.          return undefined;
  42.       }
  43.       if(_loc2_.exitTimes > 0)
  44.       {
  45.          if(!--_loc2_.exitTimes)
  46.          {
  47.             this.queue.shift();
  48.             if(!this.queue.length)
  49.             {
  50.                delete this.mc.onEnterFrame;
  51.             }
  52.          }
  53.       }
  54.    }
  55. }
  56.