Jump to content


Tiago Dias mp3 Tutorial question


  • You cannot reply to this topic
7 replies to this topic

#1 am34012

    Young Padawan

  • Members
  • Pip
  • 11 posts

Posted 18 January 2006 - 12:09 AM

Hello,

I have followed every step in this tutorial by Tiago Dias on creating mp3 flash player using xml : http://www.pixel2life.com/twodded/t_create...yer_using_xml_/

But for some reason, when 1 song finish playing, the second song doesnt start, and I tried to remove the second song and just leave one song, but still same problem. I just want to the mp3 to loop. The tutorial live example loops perfectly : http://www.pixel2life.com/twodded/staff/ti...udioplayer.html

Is anybody familiar with that tutorial? It is very helpful and easy to follow, if only this small problem with looping could be fixed, I will be the happiest *flash mx 2004 Noob* on the planet! :)

#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 18 January 2006 - 04:40 AM

there was a typo on the tutorial maybe you missed it.
here the correct code:

this.sound_obj.onSoundComplete = function () {
(song_nr==songfiles.length-1)? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr]);
}


#3 am34012

    Young Padawan

  • Members
  • Pip
  • 11 posts

Posted 18 January 2006 - 09:25 AM

No, I don't see any typo, here is the code that I have: (Identical to the working tutorial)

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]);
};
};
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.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};
btn_rev.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");


Here is my the problem: It plays sound once, and then it gives me this error: music:
Klaus Badelt 25 Hidden Souls.mp3
music: Klaus Badelt 25 Hidden Souls.mp3
Error opening URL "file:///C|/Documents%20and%20Settings/am000034012/Desktop/WEBS/DOJJI/AM34012/"

#4 am34012

    Young Padawan

  • Members
  • Pip
  • 11 posts

Posted 18 January 2006 - 09:28 AM

My site http://www.am34012.com/test/main.html

#5 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 18 January 2006 - 11:16 AM

There is again the typoerror I mentioned before..

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(songfile[song_nr], songname[song_nr]); //<- TYPO ERROR it was "songfiles" instead of "songfile"
};
};
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.sound_mc.songStarter(songfile[song_nr], songname[song_nr]);
};
btn_rev.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");

I've also checked my tutorial, and it's correctly written...

Edited by funkysoul, 18 January 2006 - 11:17 AM.


#6 am34012

    Young Padawan

  • Members
  • Pip
  • 11 posts

Posted 18 January 2006 - 12:41 PM

Thank you so much! It works!! <_< YAY!!!!!


Is there a way to allow the music to download first before it starts to play? It is only 1.5mb file but for some reason streaming it is very lousy...


Thank you!!!

#7 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 18 January 2006 - 05:55 PM

yeh there are other ways.. but like I said this tutorial is all about streaming the mp3 and not progressively download it.. if you want to download it first, then just import it into flash.

#8 am34012

    Young Padawan

  • Members
  • Pip
  • 11 posts

Posted 19 January 2006 - 08:08 PM

Yep! found all I needed right here on Pixel2life.com !

You guys are awsome! without you, I don't think learning flash could've been that easy ! :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users