All pastes #264357 Raw Edit

Something

public text v1 · immutable
#264357 ·published 2006-12-02 09:13 UTC
rendered paste body
stop();
trace(tracks[1]);

setInterval(Refresh, 10);
function Refresh() {
	volume_text.text = "Volume "+(buttons.sliderbar.slider._x-5)+"%";
}
//music control
Music:Sound = new Sound();
function checkprogress(mp3:Sound) {
	var loaded:Number = Math.round((mp3.getBytesLoaded()/mp3.getBytesTotal())*100);
	var pos:Number = Math.round((mp3.position/mp3.duration)*100);
	trace(loaded+"%");
	if(loaded == 10) {
		Music.start();
	} 
}
Music.onLoad = function() {
	clearInterval(progressI);
}
progressI = setInterval(checkprogress,10, Music);
buttons.sliderbar.slider._x = 80;
buttons.sliderbar.slider.onEnterFrame = function() {
	Music.setVolume(this._x-5);
};
buttons.sliderbar.slider.onPress = function() {
	startDrag(this, false, 105, this._y, 5, this._y);
};
buttons.sliderbar.slider.onRelease = function() {
	stopDrag();
};
buttons.sliderbar.slider.onReleaseOutside = function() {
	stopDrag();
};

Music.stop();
Music.loadSound(tracks[1],true);