home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / breakawish.swf / scripts / __Packages / Library / DispatcherBase.as < prev    next >
Encoding:
Text File  |  2007-09-28  |  1.1 KB  |  54 lines

  1. class Library.DispatcherBase
  2. {
  3.    var bPaused;
  4.    var aListeners;
  5.    function DispatcherBase()
  6.    {
  7.       this.bPaused = false;
  8.       this.aListeners = new Array();
  9.    }
  10.    function doEnterFrame()
  11.    {
  12.       if(!this.bPaused)
  13.       {
  14.          this.doDispatchMessage("doEnterFrame");
  15.       }
  16.    }
  17.    function doAddListener(__oRef)
  18.    {
  19.       this.aListeners.push(__oRef);
  20.    }
  21.    function doRemoveListener(__oRef)
  22.    {
  23.       for(var _loc2_ in this.aListeners)
  24.       {
  25.          if(this.aListeners[_loc2_] == __oRef)
  26.          {
  27.             delete this.aListeners[_loc2_];
  28.             this.aListeners.splice(Number(_loc2_),1);
  29.          }
  30.       }
  31.    }
  32.    function doPause()
  33.    {
  34.       this.bPaused = true;
  35.       this.doDispatchMessage("doPause");
  36.    }
  37.    function doResume()
  38.    {
  39.       this.bPaused = false;
  40.       this.doDispatchMessage("doResume");
  41.    }
  42.    function doDestroy()
  43.    {
  44.       delete this.aListeners;
  45.    }
  46.    function doDispatchMessage(__sMessage)
  47.    {
  48.       for(var _loc3_ in this.aListeners)
  49.       {
  50.          this.aListeners[_loc3_][__sMessage]();
  51.       }
  52.    }
  53. }
  54.