hola te envió uno que me funciona a mi es con xml todo dentro de un clip de película espero te sirva y me aviasas
este es AS3 que va en el reproductor
Código ActionScript :
var getMusic:URLRequest;
var music:Sound = new Sound();
var soundChannel:SoundChannel;
var currentSound:Sound = music;
var pos:Number;
var currentIndex:Number = 0;
var songPlaying:Boolean = false;
var xml:XML;
var songlist:XMLList;
function loadProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
if(percentLoaded > 20){
trace("loading");
} else{
}
}
function completeHandler(event):void {
trace("DONE");
}
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, whenLoaded);
loader.load(new URLRequest("songs.xml"));
function whenLoaded(e:Event):void
{
xml = new XML(e.target.data);
songlist = xml.song;
getMusic = new URLRequest(songlist[0].url);
music.load(getMusic);//load music
soundChannel = music.play();
songTXT.text = songlist[0].title;
artistTXT.text = songlist[0].artist;
albumTXT.text = songlist[0].album;
soundChannel.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
next_btn.addEventListener(MouseEvent.CLICK, nextSong);
prev_btn.addEventListener(MouseEvent.CLICK, prevSong);
pause_btn.addEventListener(MouseEvent.CLICK,pauseSong);
function nextSong(e:Event):void
{
if (currentIndex < (songlist.length() - 1))
{
currentIndex++;
}
else
{
currentIndex = 0;
}
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].url);
var nextTitle:Sound = new Sound(nextReq);
soundChannel.stop();
songTXT.text = songlist[currentIndex].title;
artistTXT.text = songlist[currentIndex].artist;
albumTXT.text = songlist[currentIndex].album;
soundChannel = nextTitle.play();
songPlaying = true;
currentSound = nextTitle;
soundChannel.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
function prevSong(e:Event):void
{
if (currentIndex > 0)
{
currentIndex--;
}
else
{
currentIndex = songlist.length() - 1;
}
var nextReq:URLRequest = new URLRequest(songlist[currentIndex].url);
var prevTitle:Sound = new Sound(nextReq);
soundChannel.stop();
songTXT.text = songlist[currentIndex].title;
artistTXT.text = songlist[currentIndex].artist;
albumTXT.text = songlist[currentIndex].album;
soundChannel = prevTitle.play();
songPlaying = true;
currentSound = prevTitle;
soundChannel.addEventListener(Event.SOUND_COMPLETE, nextSong);
}
function pauseSong(e:Event):void
{
pos = soundChannel.position;
soundChannel.stop();
songPlaying = false;
play_btn.addEventListener(MouseEvent.CLICK,playSong);
}
function playSong(e:Event):void
{
if(songPlaying == false)
{
soundChannel = currentSound.play(pos);
soundChannel.addEventListener(Event.SOUND_COMPLETE, nextSong);
songPlaying = true;
play_btn.removeEventListener(MouseEvent.CLICK,playSong);
}
}
ahora creas un xml con la lista de canciones que quieres no olvides cambiar los titulos estas son de una web qe hice hace rato los archivos mp3 creas una carpeta llamada" songs"
Código XML :
<?xml version="1.0" encoding="ISO-8859-1"?>
<ipod>
<song>
<title>Tu pureza</title>
<artist>Felipe Gómez</artist>
<album>La vida</album>
<url>songs/track1.mp3</url>
</song>
<song>
<title>San José carpintero</title>
<artist>Felipe Gómez</artist>
<album>La vida</album>
<url>songs/track2.mp3</url>
</song>
<song>
<title>La vida</title>
<artist>Felipe Gómez</artist>
<album>La vida</album>
<url>songs/track5.mp3</url>
</song>
</ipod>
si quieres verlo funcionando
entra a
www.bajotumanto.com