home *** CD-ROM | disk | FTP | other *** search
/ Neil's C++ Stuff / 2016-02-neilstuff-weebly.iso / apps / audioPlayer2.swf / scripts / __Packages / Progress.as < prev    next >
Text File  |  2016-02-05  |  1KB  |  60 lines

  1. class Progress extends MovieClip
  2. {
  3.    function Progress()
  4.    {
  5.       super();
  6.       AsBroadcaster.initialize(this);
  7.       this.bar_mc._width = 0;
  8.       this._movingHead = false;
  9.       this.track_mc.onPress = mx.utils.Delegate.create(this,function()
  10.       {
  11.          this._movingHead = true;
  12.          this._moveProgressBar();
  13.       }
  14.       );
  15.       this.track_mc.onMouseMove = mx.utils.Delegate.create(this,function()
  16.       {
  17.          if(this._movingHead)
  18.          {
  19.             this._moveProgressBar();
  20.          }
  21.       }
  22.       );
  23.       this.track_mc.onRelease = this.track_mc.onReleaseOutside = mx.utils.Delegate.create(this,function()
  24.       {
  25.          this.broadcastMessage("onMoveHead",this.bar_mc._width / this.track_mc._width);
  26.          this._movingHead = false;
  27.       }
  28.       );
  29.    }
  30.    function updateProgress(played)
  31.    {
  32.       if(!this._movingHead)
  33.       {
  34.          this.bar_mc._width = Math.round(played * this.track_mc._width);
  35.       }
  36.    }
  37.    function setMaxValue(maxValue)
  38.    {
  39.       this._maxPos = maxValue * this.track_mc._width;
  40.    }
  41.    function resize(newWidth)
  42.    {
  43.       this.track_mc._width = newWidth - 2;
  44.       this.border_mc._width = newWidth;
  45.    }
  46.    function _moveProgressBar()
  47.    {
  48.       var _loc2_ = this._xmouse - 1;
  49.       if(_loc2_ < 0)
  50.       {
  51.          _loc2_ = 0;
  52.       }
  53.       else if(_loc2_ > this._maxPos)
  54.       {
  55.          _loc2_ = this._maxPos;
  56.       }
  57.       this.bar_mc._width = _loc2_;
  58.    }
  59. }
  60.