home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / State.as < prev    next >
Encoding:
Text File  |  2013-04-24  |  1.2 KB  |  60 lines

  1. class State
  2. {
  3.    var mcRef;
  4.    var sState;
  5.    function State(_mcRef, _bNormal)
  6.    {
  7.       this.mcRef = _mcRef;
  8.       this.sState = "";
  9.       if(_bNormal == false)
  10.       {
  11.          if(MainBroadcaster.Instance == null)
  12.          {
  13.             var _loc4_ = new MainBroadcaster();
  14.          }
  15.          MainBroadcaster.Instance.doAddListener(this);
  16.       }
  17.       else
  18.       {
  19.          if(Broadcaster.Instance == null)
  20.          {
  21.             var _loc5_ = new Broadcaster();
  22.          }
  23.          Broadcaster.Instance.doAddListener(this);
  24.       }
  25.    }
  26.    function cleanUp()
  27.    {
  28.       Broadcaster.Instance.doRemoveListener(this);
  29.    }
  30.    function doAction()
  31.    {
  32.       this[this.sState]();
  33.    }
  34.    function setState(_sState)
  35.    {
  36.       if(this.sState != _sState)
  37.       {
  38.          this.sState = _sState;
  39.          this.mcRef.gotoAndStop(_sState);
  40.       }
  41.    }
  42.    function doPause()
  43.    {
  44.       this.mcRef.mcState.stop();
  45.    }
  46.    function doUnPause()
  47.    {
  48.       this.mcRef.mcState.play();
  49.    }
  50.    function stateFinished()
  51.    {
  52.       var _loc2_ = false;
  53.       if(this.mcRef.mcState._currentframe >= this.mcRef.mcState._totalframes)
  54.       {
  55.          _loc2_ = true;
  56.       }
  57.       return _loc2_;
  58.    }
  59. }
  60.