home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Esportes / CrossingCup.swf / scripts / __Packages / Scrollbar.as < prev    next >
Text File  |  2007-12-11  |  2KB  |  67 lines

  1. class Scrollbar extends MovieClip
  2. {
  3.    var tumbheight = 387;
  4.    function Scrollbar()
  5.    {
  6.       super();
  7.       if(this._name == "horz")
  8.       {
  9.          this.Thumb.onMouseDown = function()
  10.          {
  11.             if(this.hitTest(_root._xmouse,_root._ymouse,true))
  12.             {
  13.                this.startDrag(true,409,0,20,0);
  14.                this.iScroller = setInterval(this._parent.mouseMovement,5,this._parent);
  15.             }
  16.          };
  17.       }
  18.       else
  19.       {
  20.          this.Thumb.onMouseDown = function()
  21.          {
  22.             if(this.hitTest(_root._xmouse,_root._ymouse,true))
  23.             {
  24.                this.startDrag(true,0,387);
  25.                this.iScroller = setInterval(this._parent.mouseMovement,5,this._parent);
  26.             }
  27.          };
  28.       }
  29.       this.Thumb.onMouseUp = function()
  30.       {
  31.          this.stopDrag();
  32.          clearInterval(this.iScroller);
  33.       };
  34.    }
  35.    function mouseMovement(_this)
  36.    {
  37.       if(_this._name == "horz")
  38.       {
  39.          var _loc3_ = _this.Thumb._x - 20;
  40.          if(_loc3_ < 0)
  41.          {
  42.             _loc3_ = 0;
  43.          }
  44.          if(_loc3_ > 409)
  45.          {
  46.             _loc3_ = 409;
  47.          }
  48.          var _loc6_ = _loc3_ / 387 * 100;
  49.          _global.__DISPATCH({type:"thumbMovement",param:_loc6_,horz:true});
  50.       }
  51.       else
  52.       {
  53.          var _loc2_ = _this.Thumb._y;
  54.          if(_loc2_ < 0)
  55.          {
  56.             _loc2_ = 0;
  57.          }
  58.          if(_loc2_ > 387)
  59.          {
  60.             _loc2_ = 387;
  61.          }
  62.          var _loc5_ = _loc2_ / 387 * 100;
  63.          _global.__DISPATCH({type:"thumbMovement",param:_loc5_,horz:false});
  64.       }
  65.    }
  66. }
  67.