All pastes #554510 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-10 05:15 UTC
rendered paste body
stop();
playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
	if (success) {
		_global.songname = [];
		_global.songband = [];
		_global.songfile = [];
		for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
			_global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
			_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
			trace(songname[i]+"  "+songfile[i]);
		}
	}
	_root.createEmptyMovieClip("sound_mc", 1);
	_root.sound_mc.sound_obj = new Sound();
	_global.song_nr = random(songfile.length);
	_root.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};
MovieClip.prototype.songStarter = function(file, name) {
	this.sound_obj.loadSound(file, true);
	this.onEnterFrame = function() {
		if (this.sound_obj.position>0) {
			delete this.onEnterFrame;
			this._parent.display_txt.text = name;
		} else {
			this._parent.display_txt.text = "loading...";
		}
	};
	this.sound_obj.onSoundComplete = function() {
		(song_nr == songfiles.length-1) ? _global.song_nr=0 : _global.song_nr++;
		_root.sound_mc.songStarter(songfiles[song_nr], songname[song_nr]);
	};
};