I recently found a GREAT tutorial on creating a simple xml based mp3 player. You can download the source files here: http://site.inmod.com/flash/playerfixed.zip
However, I’m having a problem since I have a very limited understanding of actionscript. Can someone please tell me how to alter the actionscript code so that the player continuously cycles through the playlist, rather than just playing the song once? I altered the actionscript a little to fit my project–see below:
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* = playlist.firstChild.childNodes*.attributes.name;
_global.songfile* = playlist.firstChild.childNodes*.attributes.file;
trace(songname*+" "+songfile*);
}
}
_root.mp3.createEmptyMovieClip(“sound_mc”, 1);
_root.mp3.sound_mc.sound_obj = new Sound();
_global.song_nr = random(songfile.length);
_root.mp3.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};
MovieClip.prototype.songStarter = function(file, name) {
this.soun! d_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.mp3.sound_mc.songStarter(songfiles[song_nr], songname[song_nr]);
};
};
btn_play.onRelease = function() {
this._parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};
btn_stop.onRelease = function() {
this._parent.sound_mc.sound_obj.stop();
};
btn_fw.onRelease = function() {
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_root.mp3.sound_mc.songStarter(songfile[song_nr], so! ngname[song_nr]);
};
btn_rev.onRelease = function() {
(song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr–;
_root.mp3.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};
playlist.load(“playlist.xml”);