All pastes #551788 Raw Edit

Something

public text v1 · immutable
·published 2007-06-08 23:00 UTC
rendered paste body
/*READ FIRST -> http://livedocs.adobe.com/flash/8/main/00002201.html*/
import flash.external.*;
ExternalInterface.addCallback("switchTrack", this, switchTrack);
var sound:Sound = new Sound(this);
sound.onID3 = function() {
	startTracking();
};
function switchTrack(mp3) {
	sound.loadSound(mp3, true);
}
function startTracking() {
	onEnterFrame = function () {
		var bl:Number = sound.getBytesLoaded();
		var bt:Number = sound.getBytesTotal();
		loaded._width = bl/bt*background._width;
		if (sound.duration) {
			position._width = sound.position/sound.duration*background._width;
			current.text = getTimecode(sound.position/1000);
			total.text = getTimecode(sound.duration/1000);
			grip._x = position._x+position._width;
		}
	};
}