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

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