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

  1. class CSlider extends MovieClip
  2. {
  3.    var origwidth;
  4.    var dragging;
  5.    var slidebar;
  6.    function CSlider()
  7.    {
  8.       super();
  9.       this.origwidth = this._width;
  10.       this.dragging = false;
  11.    }
  12.    function onPress()
  13.    {
  14.       _global.__DISPATCH({type:"sliderpress",param:this});
  15.       if(!this.dragging)
  16.       {
  17.          this.setWidth();
  18.       }
  19.       this.dragging = true;
  20.    }
  21.    function onRelease()
  22.    {
  23.       _global.__DISPATCH({type:"sliderrelease",param:this});
  24.       this.dragging = false;
  25.    }
  26.    function onReleaseOutside()
  27.    {
  28.       _global.__DISPATCH({type:"sliderrelease",param:this});
  29.       this.dragging = false;
  30.    }
  31.    function setWidth()
  32.    {
  33.       var _loc2_ = this._xmouse;
  34.       if(_loc2_ > this.origwidth)
  35.       {
  36.          _loc2_ = this.origwidth;
  37.       }
  38.       this.slidebar._width = _loc2_;
  39.    }
  40.    function setVal(val)
  41.    {
  42.       this.slidebar._width = val * (this.origwidth / 100);
  43.    }
  44.    function getVal()
  45.    {
  46.       return this.slidebar._width / this.origwidth * 100;
  47.    }
  48.    function onMouseMove()
  49.    {
  50.       if(!this.dragging)
  51.       {
  52.          return undefined;
  53.       }
  54.       _global.__DISPATCH({type:"slidermove",param:this});
  55.       this.setWidth();
  56.    }
  57. }
  58.