todo me funciona bien, pero ahora quisiera ponerle lo del album Grax.
éste es el código:
Código :
_root.playlist == undefined ? playlist="mp3player.xml" : playlist=_root.playlist;
// Variables de escenario
Stage.showMenu = false;
Stage.scaleMode = "noScale";
stop();
// Variables del reproductor
volume = 90;
current_song = 1;
top.equalizer._visible = 0;
// La carga del playlist
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(playlist);
// Analizando todos los datos del xml en flash
function loadData(success) {
if (success) {
// Comando de mostrar display y playlist
showDisplay = this.firstChild.attributes.showDisplay;
if (showDisplay == "yes") {
top.easeY(toppos);
topup = false;
display_btn._rotation += 180;
}
showPlaylist = this.firstChild.attributes.showPlaylist;
if (showPlaylist == "yes") {
bot.easeY(botpos);
botup = false;
list_btn._rotation += 180;
}
// Obteber todos los titulos y nombres de archivo
aPath = new Array();
songTitel = new Array();
audioTracks = new Array();
audioTracks.shuffle();
audioTracks = this.firstChild.childNodes;
song_total = audioTracks.length;
for (var i = 0; i<song_total; i++) {
aPath.push(audioTracks[i].attributes.path);
songTitel.push(audioTracks[i].attributes.title);
// Construyendo los botones del playlist
bot.playlist.btn.duplicateMovieClip("btn"+i, i);
bot.playlist["btn"+i]._y = bot.playlist.btn._y+i*int(bot.playlist.btn._height)+i;
bot.playlist["btn"+i].txt = checkDigits(i+1)+". "+songTitel[i];
bot.playlist["btn"+i].hit.onPress = function() {
listClick(this._parent.getDepth()+1);
};
}
// Chequeo del modo autostart (que puede ser "no" "yes" o "random")
autoStart = this.firstChild.attributes.autoStart;
if (autoStart == "yes") {
playSong();
play_btn._visible = 0;
} else if (autoStart == "no") {
play_btn._visible = 1;
pause_btn._visible = 0;
} else if (autoStart == "random") {
current_song = random(song_total)+1;
playSong();
play_btn._visible = 0;
} else {
current_song = int(this.firstChild.attributes.autoStart);
playSong();
play_btn._visible = 0;
}
}
// Hecho! todos cargaron con éxito. Depurando basura
delete audioTracks;
delete data_xml;
}
// Botón de la lista
function listClick(prm) {
delete pausepos;
current_song = prm;
MySound.stop();
playSong();
}
// Scroller de la lista (Cuando hay muchas canciones)
bot.list_bg.onEnterFrame = function() {
if (hitTest(_root._xmouse, _root._ymouse, true) && this._parent.playlist._height>this._height) {
ymin = this._y+this._height-this._parent.playlist._height;
ymax = this._y+3;
conv = (this._ymouse-15)*1.3/this._height;
conv>1 ? conv=1 : null;
conv<0 ? conv=0 : null;
this._parent.playlist.easeY(ymax-conv*(ymax-ymin));
}
};
bot.playlist.setMask(bot.list_bg);
// Función play
function playSong() {
AudioPath = aPath[current_song-1];
// Chequeo para pause > start
if (pausePos>0) {
top.equalizer._visible = 1;
MySound.start(pausePos, 0);
pausePos = 0;
// Ponga en marcha el nuevo sonido
} else {
MySound = new Sound();
MySound.setVolume(volume);
MySound.loadSound(AudioPath, true);
MySound.onSoundComplete = function() {
top.equalizer._visible = 0;
if (autoStart == "random") {
current_song = random(song_total)+1;
} else if (loop_song == true) {
current_song == 0;
} else {
current_song == song_total ? current_song=1 : current_song++;
}
playSong();
};
// Chequeo de la barra de carga
top.track_load.onEnterFrame = function() {
total = this._parent._parent.MySound.getBytesTotal();
geladen = this._parent._parent.MySound.getBytesLoaded();
if (geladen != total) {
this._parent.load_display = Math.round((geladen*100/total))+"% Cargado";
this._xscale = Math.round((geladen*100/total));
} else {
this._xscale = 100;
top.equalizer._visible = 1;
delete this.onEnterFrame;
delete this._parent.load_display;
}
};
}
// Switch de los botones play/pause
play_btn._visible = 0;
pause_btn._visible = 1;
}
// Botón play
play_btn.onRollOver = function() {
play_pause.gotoAndStop(2);
};
play_btn.onRollOut = function() {
play_pause.gotoAndStop(1);
};
play_btn.onRelease = function() {
playSong();
};
// Botón pause
pause_btn.onRollOver = function() {
play_pause.gotoAndStop(2);
};
pause_btn.onRollOut = function() {
play_pause.gotoAndStop(1);
};
pause_btn.onRelease = function() {
this._visible = 0;
play_btn._visible = 1;
pausePos = MySound.position/1000;
MySound.stop();
top.equalizer._visible = 0;
};
// Botón next
next_btn.onRollOver = function() {
next.gotoAndStop(2);
};
next_btn.onRollOut = function() {
next.gotoAndStop(1);
};
next_btn.onRelease = function() {
delete pausepos;
current_song == song_total ? current_song=1 : current_song++;
MySound.stop();
playSong();
};
// Botón previous
prev_btn.onRollOver = function() {
prev.gotoAndStop(2);
};
prev_btn.onRollOut = function() {
prev.gotoAndStop(1);
};
prev_btn.onRelease = function() {
delete pausepos;
current_song == 1 ? current_song=song_total : current_song--;
MySound.stop();
playSong();
};
// Botón del display
top.setMask(top_mask);
toppos = top._y;
top._y = int(toppos+top_mask._height-29);
topup = true;
display_btn.onPress = function() {
if (topup == true) {
top.easeY(toppos);
topup = false;
} else {
top.easeY(int(toppos+top_mask._height-27));
topup = true;
}
this._rotation += 180;
};
// Botón del playlist
bot.setMask(bot_mask);
botpos = bot._y;
bot._y = botpos-bot.list_bg._height-6;
botup = true;
list_btn.onPress = function() {
if (botup == true) {
bot.easeY(botpos);
botup = false;
} else {
bot.easeY(botpos-bot.list_bg._height-6);
botup = true;
}
this._rotation += 180;
};
// Boton del drag (toda escena)
drag_btn.onPress = function() {
startDrag(this._parent);
};
drag_btn.onRelease = drag_btn.onReleaseOutside=function () { stopDrag();};
// Boton del enlace
copy.onPress = function() {
getURL("http://www.osiris-videos.cjb.net", "_blank");
};
// Actualización del tiempo del display
this.onEnterFrame = function() {
dur = int(MySound.duration/1000);
pos = int(MySound.position/1000);
playTime = {};
playTime.minutes = int((pos)/60);
playTime.seconds = int((pos)%60);
playTime.total = checkDigits(playTime.minutes)+":"+checkDigits(playTime.seconds);
trackTime = {};
trackTime.minutes = int(dur/60);
trackTime.seconds = int(dur%60);
trackTime.total = checkDigits(trackTime.minutes)+":"+checkDigits(trackTime.seconds);
if (top.load_display == undefined) {
top.display = playTime.total+" / "+trackTime.total;
} else {
top.display = top.load_display;
}
if (top.trackDrag != true) {
prozent = pos*100/dur;
top.track_play._xscale = prozent;
}
};
// Prefijando un 0 al tiempo
function checkDigits(toCheck) {
return (toCheck<10) ? toCheck="0"+toCheck : toCheck;
}
// Funciones del slider del progreso de la pista
top.track_back.onPress = function() {
this._parent.trackDrag = true;
this._parent.track_play.onEnterFrame = function() {
perc = (this._parent._xmouse-this._parent.track_back._x)/this._parent.track_back._width;
max = this._parent.track_load._width/this._parent.track_back._width;
perc>max ? perc=max : null;
perc<0.01 ? perc=0.01 : null;
this._width = this._parent.track_back._width*perc;
this._parent._parent.pausePos = (perc*this._parent._parent.MySound.duration/1000);
};
};
top.track_back.onRelease = top.track_back.onReleaseOutside=function () { delete this._parent.track_play.onEnterFrame;this._parent.trackDrag = false;MySound.stop();playSong();};
// Funciones del volumen
vol_back.onPress = function() {
vol_front.onEnterFrame = function() {
perc = (_xmouse-vol_back._x)/vol_back._width;
perc>0.95 ? perc=1 : null;
perc<0.05 ? perc=0 : null;
this._width = vol_back._width*perc;
volume = Math.round(perc*100);
MySound.setVolume(volume);
top.equalizer._yscale = volume;
};
};
vol_back.onRelease = vol_back.onReleaseOutside=function () { delete vol_front.onEnterFrame;};
vol_front.setMask(vol_mask);
// Dibujando equalizador
top.equalizer.setMask(top.eq_mask);
top.equalizer.onEnterFrame = function() {
i++;
this.createEmptyMovieClip("graph"+i, i);
with (this["graph"+i]) {
_x = 0;
_y = 0;
// Color de las barras de equalizer
beginFill(0xFFCC00, 50);
moveTo(0, 0);
for (j=0; j<36; j++) {
z = random(12)+8;
lineTo(j*6, -1);
lineTo(j*6, -z);
lineTo(j*6+4, -z);
lineTo(j*6+4, -1);
lineTo(j*6, -1);
}
lineTo(j*6, 0);
lineTo(0, 0);
endFill();
}
i>=3 ? i=0 : null;
};
// scrolling del titulo de la canción (Cuando el titulo está largo)
function scrollTitle() {
top.title.txt.autoSize = true;
if (songTitel[current_song-1].length>20) {
top.title.txt.text = songTitel[current_song-1]+" "+songTitel[current_song-1];
top.title._x+top.title._width/2+4<top.title_mask._x ? top.title._x=top.title_mask._x : top.title._x--;
} else {
top.title.txt.text = songTitel[current_song-1];
top.title._x = top.title_mask._x-3;
}
}
top.title.setMask(top.title_mask);
setInterval(scrollTitle, 40);
// Despliegue aliviado y movimiento del playlist
MovieClip.prototype.easeY = function(t) {
this.onEnterFrame = function() {
this._y = int(t-(t-this._y)/1.5);
if (this._y>t-1 && this._y<t+1) {
delete this.onEnterFrame;
}
};
};
y éste otro es el que uso en el .xml
Código :
<?xml version="1.0" encoding="UTF-8"?> <player showDisplay="yes" showPlaylist="yes" autoStart="random"> <song path="media/himtrax/audio/DarkLight/darklight.mp3" title="Killing Loneliness"/> </player>
De antemano muchas gracias, y me urge porfavor, Gracias!
