All pastes #264352 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-02 09:03 UTC
rendered paste body
stop();
trace(tracks[1]);
var progressI = setInterval(checkprogress,10, Music);
setInterval(Refresh, 10);
function Refresh() {
	volume_text.text = "Volume "+(buttons.sliderbar.slider._x-5)+"%";
}
//music control
Music = new Sound();
function checkprogress(mp3:Sound) {
	var loaded = Math.round((mp3.getBytesLoaded()/mp3.getBytesTotal())*100);
	var pos = Math.round((mp3.position/mp3.duration)*100);
	trace(loaded+"%");
	if(loaded>10) {
		Music.start();
	} else {
		Music.stop();
	}
}
Music.onLoad = function() {
	clearInterval(progressI);
}

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.loadSound(tracks[1],true);