home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / VenusMission.swf / scripts / __Packages / extensions / movieclip / SimpleButton.as
Encoding:
Text File  |  2008-09-23  |  1.9 KB  |  67 lines

  1. class extensions.movieclip.SimpleButton
  2. {
  3.    var MC;
  4.    var rolloutAction = null;
  5.    var rolloverAction = null;
  6.    var releaseoutsideAction = null;
  7.    var releaseAction = null;
  8.    var pressAction = null;
  9.    function SimpleButton(tMC, _release, _rollover, _rollout, _press, _releaseoutside, _dragin, _dragout)
  10.    {
  11.       this.MC = tMC;
  12.       this.MC.isbutton = true;
  13.       this.rolloutAction = _rollout;
  14.       this.rolloverAction = _rollover;
  15.       this.releaseoutsideAction = _releaseoutside != undefined ? _releaseoutside : _release;
  16.       this.releaseAction = _release;
  17.       this.pressAction = _press;
  18.       this.MC.onRollOver = system.Delegate.create(this,this.RollOver);
  19.       this.MC.onRollOut = system.Delegate.create(this,this.RollOut);
  20.       this.MC.onRelease = system.Delegate.create(this,this.Release);
  21.       this.MC.onPress = system.Delegate.create(this,this.Press);
  22.       this.MC.onReleaseOutside = system.Delegate.create(this,this.ReleaseOutside);
  23.       this.MC.onDragOver = _dragin;
  24.       this.MC.onDragOut = _dragout;
  25.       for(var name in this.MC)
  26.       {
  27.          if(name.indexOf("hit") != -1)
  28.          {
  29.             this.MC.hitArea = this.MC[name]._visible = false;
  30.          }
  31.       }
  32.       this.MC.gotoAndPlay("start");
  33.    }
  34.    function RollOut()
  35.    {
  36.       this.MC.gotoAndPlay("rollout");
  37.       this.rolloutAction();
  38.    }
  39.    function RollOver()
  40.    {
  41.       this.MC.gotoAndPlay("rollover");
  42.       this.rolloverAction();
  43.    }
  44.    function ReleaseOutside()
  45.    {
  46.       this.MC.gotoAndPlay("release");
  47.       this.releaseoutsideAction();
  48.    }
  49.    function Release()
  50.    {
  51.       this.MC.gotoAndPlay("release");
  52.       this.releaseAction();
  53.    }
  54.    function Press()
  55.    {
  56.       if(this.pressAction != undefined)
  57.       {
  58.          this.MC.gotoAndPlay("onpress");
  59.          this.pressAction();
  60.       }
  61.       else
  62.       {
  63.          this.MC.gotoAndStop("release");
  64.       }
  65.    }
  66. }
  67.