Saludos:
Código :
var pos:Number = 0; var posFinal:Number = 0; var indice:Number = 0; var mp3:Sound = new Sound(); var xml:XML = new XML(); xml.ignoreWhite = true; xml.load("lista.xml"); xml.onLoad = function(exito) { if (exito) { mp3.loadSound("musica/"+xml.firstChild.childNodes[0].attributes.dir, true); } else { trace("Error"); } } btnAtras.onRelease = function() { indice--; if (indice < 0) indice = xml.firstChild.childNodes.length-1; mp3.loadSound("musica/"+xml.firstChild.childNodes[indice].attributes.dir, true); } btnPausar.onRelease = function() { pos = mp3.position; mp3.stop(); } btnPlay.onRelease = function() { mp3.start(pos/1000); } btnDetener.onRelease = function() { mp3.stop(); pos = 0; } btnAdelante.onRelease = function() { indice++; if (indice >= xml.firstChild.childNodes.length) indice = 0; mp3.loadSound("musica/"+xml.firstChild.childNodes[indice].attributes.dir, true); } barra.rep.stop(); barra.zona.stop(); onEnterFrame = function() { posFinal = Math.round(mp3.getBytesLoaded()*100/mp3.getBytesTotal()); barra.zona.gotoAndStop(posFinal); var posFinal2:Number = Math.round(mp3.position*posFinal/mp3.duration); barra.rep.gotoAndStop(posFinal2); autor.text = mp3.id3.artist+" - "+mp3.id3.songname; } barra.onRelease = function() { if (barra._xmouse/2 < posFinal) mp3.start(barra._xmouse/2*mp3.duration/posFinal/1000); } mp3.onSoundComplete=function() { indice++; if (indice >= xml.firstChild.childNodes.length) indice = 0; mp3.loadSound("musica/"+xml.firstChild.childNodes[indice].attributes.dir, true); }