home *** CD-ROM | disk | FTP | other *** search
/ Practice Anatomy Lab / PAL.ISO / pc / PAL.swf / scripts / __Packages / mx / transitions / BroadcasterMX.as next >
Encoding:
Text File  |  2007-03-19  |  1.5 KB  |  61 lines

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