home *** CD-ROM | disk | FTP | other *** search
- class Progress extends MovieClip
- {
- var bar_mc;
- var _movingHead;
- var track_mc;
- var broadcastMessage;
- var _maxPos;
- var border_mc;
- function Progress()
- {
- super();
- AsBroadcaster.initialize(this);
- this.bar_mc._width = 0;
- this._movingHead = false;
- this.track_mc.onPress = mx.utils.Delegate.create(this,function()
- {
- this._movingHead = true;
- this._moveProgressBar();
- }
- );
- this.track_mc.onMouseMove = mx.utils.Delegate.create(this,function()
- {
- if(this._movingHead)
- {
- this._moveProgressBar();
- }
- }
- );
- this.track_mc.onRelease = this.track_mc.onReleaseOutside = mx.utils.Delegate.create(this,function()
- {
- this.broadcastMessage("onMoveHead",this.bar_mc._width / this.track_mc._width);
- this._movingHead = false;
- }
- );
- }
- function updateProgress(played)
- {
- if(!this._movingHead)
- {
- this.bar_mc._width = Math.round(played * this.track_mc._width);
- }
- }
- function setMaxValue(maxValue)
- {
- this._maxPos = maxValue * this.track_mc._width;
- }
- function resize(newWidth)
- {
- this.track_mc._width = newWidth - 2;
- this.border_mc._width = newWidth;
- }
- function _moveProgressBar()
- {
- var _loc2_ = this._xmouse - 1;
- if(_loc2_ < 0)
- {
- _loc2_ = 0;
- }
- else if(_loc2_ > this._maxPos)
- {
- _loc2_ = this._maxPos;
- }
- this.bar_mc._width = _loc2_;
- }
- }
-