<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Code The World — Streaming Flash AS2  MP3 player]]></title>
	<link rel="self" href="https://codetheworld.com/extern.php?action=feed&amp;tid=118&amp;type=atom" />
	<updated>2010-05-14T05:25:53Z</updated>
	<generator>PunBB</generator>
	<id>https://codetheworld.com/viewtopic.php?id=118</id>
		<entry>
			<title type="html"><![CDATA[Streaming Flash AS2  MP3 player]]></title>
			<link rel="alternate" href="https://codetheworld.com/viewtopic.php?pid=374#p374" />
			<content type="html"><![CDATA[<p><a href="https://dcloser11.info/audioplayer.html">Working Example</a><br /><a href="https://dcloser11.info/mp3.rar">Adobe CS4 project files </a></p><p>All you have to do is edit the Playlist.xml to your desires and you are able to have your own streaming media player <img src="https://codetheworld.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p><p>Iv included the .fla incase anyone would like to load it into flash and see what code was used and its functions</p><p>A working example is also included</p><p>Action script 2 code that was used<br /></p><div class="codebox"><pre><code>stop();
playlist= new XML();
playlist.ignoreWhite=true;
playlist.onload = function (success) {
if(success) {
_global.songname = [];
_global.songfile = [];
for (var i=0; i&lt;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]+\&quot; \&quot;+songfile[i]); }
_root.createEmptyMovieClip(\&quot;sound_mc\&quot;,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=\&quot;Error Loading XML\&quot;}
}

MovieClip.prototype.songStarter = function (file, name) {
this.sound_obj.loadSound(file,true)
this.onEnterFrame = function () {
if(this.sound_obj.position&gt;0) {
delete this.onEnterFrame;
this._parent.display_txt.text=name; 
} else {
this._parent.display_txt.text=\&quot;loading...\&quot; 
}
}
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(\&quot;playlist.xml\&quot;);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DCLoser11]]></name>
				<uri>https://codetheworld.com/profile.php?id=421</uri>
			</author>
			<updated>2010-05-14T05:25:53Z</updated>
			<id>https://codetheworld.com/viewtopic.php?pid=374#p374</id>
		</entry>
</feed>
