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

  1. class Library.State
  2. {
  3.    var mcRef;
  4.    var bStateLocked;
  5.    var bPaused;
  6.    var sState;
  7.    var nStateTotalFrame;
  8.    function State(__mcRef)
  9.    {
  10.       this.mcRef = __mcRef;
  11.       this.bStateLocked = false;
  12.       this.bPaused = false;
  13.    }
  14.    function doEnterFrame()
  15.    {
  16.       this["do" + this.sState]();
  17.    }
  18.    function doPause()
  19.    {
  20.       this.bPaused = true;
  21.       this.mcRef.mcState.stop();
  22.    }
  23.    function doResume()
  24.    {
  25.       this.bPaused = false;
  26.       this.mcRef.mcState.play();
  27.    }
  28.    function setState(__sState)
  29.    {
  30.       if(!this.bStateLocked)
  31.       {
  32.          this.doForcedSetState(__sState);
  33.       }
  34.    }
  35.    function doForcedSetState(__sState)
  36.    {
  37.       if(this.sState != __sState)
  38.       {
  39.          this.doUnLoadStateAction(this.sState);
  40.          this.sState = __sState;
  41.          this.mcRef.gotoAndStop(this.sState);
  42.          this.nStateTotalFrame = this.mcRef.mcState._totalframes;
  43.          this.doLoadStateAction(this.sState);
  44.       }
  45.    }
  46.    function get Paused()
  47.    {
  48.       return this.bPaused;
  49.    }
  50.    function get CurrentState()
  51.    {
  52.       return this.sState;
  53.    }
  54.    function doLoadStateAction()
  55.    {
  56.    }
  57.    function doUnLoadStateAction()
  58.    {
  59.    }
  60.    function doLockState()
  61.    {
  62.       this.bStateLocked = true;
  63.    }
  64.    function doUnlockState()
  65.    {
  66.       this.bStateLocked = false;
  67.    }
  68.    function isStateComplete()
  69.    {
  70.       var _loc2_ = false;
  71.       if(this.mcRef.mcState._currentframe == this.nStateTotalFrame)
  72.       {
  73.          _loc2_ = true;
  74.       }
  75.       return _loc2_;
  76.    }
  77.    function isStateStarting()
  78.    {
  79.       var _loc2_ = false;
  80.       if(this.mcRef.mcState._currentframe == 1)
  81.       {
  82.          _loc2_ = true;
  83.       }
  84.       return _loc2_;
  85.    }
  86. }
  87.