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 >
Wrap
Text File
|
2016-02-05
|
1KB
|
60 lines
class Progress extends MovieClip
{
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_;
}
}