home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / germ_roundup.swf / scripts / __Packages / smashing / Menu.as < prev    next >
Encoding:
Text File  |  2007-03-20  |  3.2 KB  |  120 lines

  1. class smashing.Menu extends MovieClip
  2. {
  3.    static var target;
  4.    var bEnabled = true;
  5.    function Menu()
  6.    {
  7.       super();
  8.       smashing.Menu.target = this;
  9.    }
  10.    function onShow()
  11.    {
  12.    }
  13.    function onResume()
  14.    {
  15.    }
  16.    function show(sFrame)
  17.    {
  18.       this.onShow();
  19.       this.gotoAndPlay(sFrame);
  20.    }
  21.    function resume()
  22.    {
  23.       this.onResume();
  24.       this.gotoAndStop("blank");
  25.    }
  26.    function playAgain()
  27.    {
  28.    }
  29.    static function watchProp(o, sProp, sType)
  30.    {
  31.       var _loc1_ = o;
  32.       var _loc2_ = sProp;
  33.       switch(sType)
  34.       {
  35.          case "text":
  36.             _loc1_.watch(_loc2_,smashing.Menu.watchText);
  37.             break;
  38.          case "frameMeter":
  39.             _loc1_.watch(_loc2_,smashing.Menu.watchFrameMeter);
  40.             break;
  41.          case "pegboard":
  42.             _loc1_.watch(_loc2_,smashing.Menu.watchPegboard);
  43.             break;
  44.          case "signboard":
  45.             _loc1_.watch(_loc2_,smashing.Menu.watchSignboard);
  46.             break;
  47.          case "singleDigit":
  48.             _loc1_.watch(_loc2_,smashing.Menu.watchSingleDigit);
  49.             break;
  50.          case "funkyMeter":
  51.             _loc1_.watch(_loc2_,smashing.Menu.watchFunkyMeter);
  52.       }
  53.    }
  54.    static function watchText(prop, oldVal, newVal)
  55.    {
  56.       smashing.Menu.target[prop.toString()] = newVal;
  57.       return newVal;
  58.    }
  59.    static function watchFrameMeter(prop, oldVal, newVal)
  60.    {
  61.       var _loc2_ = smashing.Menu.target[prop.toString()];
  62.       var _loc1_ = Math.ceil(newVal * _loc2_._totalframes);
  63.       if(_loc1_ == 0)
  64.       {
  65.          _loc1_ = 1;
  66.       }
  67.       _loc2_.gotoAndStop(_loc1_);
  68.       return newVal;
  69.    }
  70.    static function watchPegboard(prop, oldVal, newVal)
  71.    {
  72.       var _loc1_ = smashing.Menu.target[prop.toString()];
  73.       _loc1_.pegs = newVal;
  74.       return newVal;
  75.    }
  76.    static function watchSignboard(prop, oldVal, newVal)
  77.    {
  78.       var _loc2_ = this;
  79.       var limit = 1;
  80.       var _loc1_ = smashing.Menu.target[prop.toString()];
  81.       _loc1_.gotoAndStop(newVal);
  82.       _loc1_.startTime = getTimer();
  83.       _loc1_.limit = limit;
  84.       _loc1_.onEnterFrame = function()
  85.       {
  86.          var _loc1_ = this;
  87.          var _loc2_ = (getTimer() - _loc1_.startTime) / 1000;
  88.          if(_loc2_ >= _loc1_.limit)
  89.          {
  90.             _loc1_._visible = false;
  91.             delete _loc1_.onEnterFrame;
  92.          }
  93.       };
  94.       return newVal;
  95.    }
  96.    static function watchSingleDigit(prop, oldVal, newVal)
  97.    {
  98.       var _loc2_ = newVal;
  99.       var _loc1_ = smashing.Menu.target[prop.toString()];
  100.       _loc1_.gotoAndStop(_loc2_ + 1);
  101.       smashing.Menu.target[prop + "cache"] = _loc2_ + 1;
  102.       return _loc2_;
  103.    }
  104.    static function watchFunkyMeter(prop, oldVal, newVal)
  105.    {
  106.       var _loc3_ = newVal;
  107.       if(_loc3_ < 0)
  108.       {
  109.          _loc3_ = 0;
  110.       }
  111.       var _loc2_ = smashing.Menu.target.funkyMeter;
  112.       var _loc1_ = _loc2_[prop.toString()];
  113.       var mcCap = _loc2_[prop.toString() + "Cap"];
  114.       _loc1_._width = _loc3_ * _loc1_.fullWidth;
  115.       mcCap._x = _loc1_._x + _loc1_._width - mcCap._width / 2;
  116.       _loc2_[prop.toString() + "Cache"] = _loc3_;
  117.       return _loc3_;
  118.    }
  119. }
  120.