home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / kung_fu.swf / scripts / __Packages / mx / transitions / BroadcasterMX.as next >
Encoding:
Text File  |  2006-06-13  |  1.5 KB  |  60 lines

  1. class mx.transitions.BroadcasterMX
  2. {
  3.    var _listeners;
  4.    function BroadcasterMX()
  5.    {
  6.    }
  7.    static function initialize(o, dontCreateArray)
  8.    {
  9.       if(o.broadcastMessage != undefined)
  10.       {
  11.          delete o.broadcastMessage;
  12.       }
  13.       o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
  14.       o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
  15.       if(!dontCreateArray)
  16.       {
  17.          o._listeners = new Array();
  18.       }
  19.    }
  20.    function addListener(o)
  21.    {
  22.       this.removeListener(o);
  23.       if(this.broadcastMessage == undefined)
  24.       {
  25.          this.broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
  26.       }
  27.       return this._listeners.push(o);
  28.    }
  29.    function removeListener(o)
  30.    {
  31.       var _loc2_ = this._listeners;
  32.       var _loc3_ = _loc2_.length;
  33.       while(_loc3_--)
  34.       {
  35.          if(_loc2_[_loc3_] == o)
  36.          {
  37.             _loc2_.splice(_loc3_,1);
  38.             if(!_loc2_.length)
  39.             {
  40.                this.broadcastMessage = undefined;
  41.             }
  42.             return true;
  43.          }
  44.       }
  45.       return false;
  46.    }
  47.    function broadcastMessage()
  48.    {
  49.       var _loc5_ = String(arguments.shift());
  50.       var _loc4_ = this._listeners.concat();
  51.       var _loc6_ = _loc4_.length;
  52.       var _loc3_ = 0;
  53.       while(_loc3_ < _loc6_)
  54.       {
  55.          _loc4_[_loc3_][_loc5_].apply(_loc4_[_loc3_],arguments);
  56.          _loc3_ = _loc3_ + 1;
  57.       }
  58.    }
  59. }
  60.