SheepSetsFire
%Europe/Berlin %513 %2005, 13:19
ik ben dus nog maar een beginneling in flash en wil een mp3 speler gestuurd met xml op mijn site hebben
HIER (http://www.pixel2life.com/twodded/t_create_a_full_streaming_flash_mp3_player_using_x ml_/page1/) vond ik dit script:
stop();
playlist= new XML();
playlist.ignoreWhite=true;
playlist.onload = function (success) {
if(success) {
_global.songname = [];
_global.songfile = [];
for (var i=0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname = 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]);
} else {display_txt.text="Error Loading XML"}
}
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==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[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_next.onRelease = function () {
(song_nr==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
btn_prev.onRelease = function () {
(song_nr==0)? _global.song_nr=songfile.length-1 : _global.song_nr--;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
playlist.load("playlist.xml");
hij begint autmatisch te spelen als je hem opent, hoe verhinder je dit? m.a.w. hoe laat je hem pas spelen als je op knop 'play' duwt
btw er staat een voorbeeld op de site
HIER (http://www.pixel2life.com/twodded/t_create_a_full_streaming_flash_mp3_player_using_x ml_/page1/) vond ik dit script:
stop();
playlist= new XML();
playlist.ignoreWhite=true;
playlist.onload = function (success) {
if(success) {
_global.songname = [];
_global.songfile = [];
for (var i=0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname = 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]);
} else {display_txt.text="Error Loading XML"}
}
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==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[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_next.onRelease = function () {
(song_nr==songfile.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
btn_prev.onRelease = function () {
(song_nr==0)? _global.song_nr=songfile.length-1 : _global.song_nr--;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}
playlist.load("playlist.xml");
hij begint autmatisch te spelen als je hem opent, hoe verhinder je dit? m.a.w. hoe laat je hem pas spelen als je op knop 'play' duwt
btw er staat een voorbeeld op de site