Necesito que me ayuden en esto, necesito hacer un reproductor de mp3 en flash, tengo el siguiente codigo(esta abajo), he tratado de hacer mi archivo XML pero no me resulta. Quiza este confundido. Alguien por favor me puede decir como tiene que ser el orden de mi XML, como lo nombro y en donde guardo mis mp3, segun el codigo que indico abajo, ayudenme please.
<<----- CODIGO AQUI ----->>
Código :
function loadData(success)
{
var _l2 = this;
if (success)
{
showDisplay = _l2.firstChild.attributes.showDisplay;
if (showDisplay == "yes")
{
top.easeY(toppos);
topup = false;
display_btn._rotation = display_btn._rotation + 180;
} // end if
showPlaylist = _l2.firstChild.attributes.showPlaylist;
if (showPlaylist == "yes")
{
bot.easeY(botpos);
botup = false;
list_btn._rotation = list_btn._rotation + 180;
} // end if
aPath = new Array();
songTitel = new Array();
audioTracks = new Array();
audioTracks.shuffle();
audioTracks = _l2.firstChild.childNodes;
song_total = audioTracks.length;
var _l1 = 0;
while (_l1 < song_total)
{
aPath.push(audioTracks[_l1].attributes.path);
songTitel.push(audioTracks[_l1].attributes.title);
bot.playlist.btn.duplicateMovieClip("btn" + _l1, _l1);
bot.playlist["btn" + _l1]._y = bot.playlist.btn._y + _l1 * int(bot.playlist.btn._height) + _l1;
bot.playlist["btn" + _l1].txt = checkDigits(_l1 + 1) + ". " + songTitel[_l1];
bot.playlist["btn" + _l1].hit.onPress = function ()
{
listClick(this._parent.getDepth() + 1);
};
_l1++;
} // end while
autoStart = _l2.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(_l2.firstChild.attributes.autoStart);
playSong();
play_btn._visible = 0;
} // end if
} // end if
delete audioTracks;
delete data_xml;
} // End of the function
function listClick(prm)
{
delete pausepos;
current_song = prm;
MySound.stop();
playSong();
} // End of the function
function playSong()
{
var _l1 = this;
AudioPath = aPath[current_song - 1];
if (pausePos > 0)
{
top.equalizer._visible = 1;
MySound.start(pausePos, 0);
pausePos = 0;
}
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
{
current_song == song_total ? (current_song = 1, current_song = 1) : (current_song++);
} // end if
playSong();
};
top.track_load.onEnterFrame = function ()
{
var _l1 = this;
total = _l1._parent._parent.MySound.getBytesTotal();
geladen = _l1._parent._parent.MySound.getBytesLoaded();
if (geladen != total)
{
_l1._parent.load_display = Math.round(geladen * 100 / total) + "% Loaded";
_l1._xscale = Math.round(geladen * 100 / total);
}
else
{
_l1._xscale = 100;
top.equalizer._visible = 1;
delete _l1["onEnterFrame"];
delete _l1._parent["load_display"];
} // end if
};
} // end if
play_btn._visible = 0;
pause_btn._visible = 1;
} // End of the function
function checkDigits(toCheck)
{
var _l1 = toCheck;
_l1 = "0" + _l1;
_l1 < 10 ? ("0" + _l1) : (_l1);
return(_l1 < 10 ? ("0" + _l1) : (_l1));
} // End of the function
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 = top.title_mask._x) : (top.title._x--);
}
else
{
top.title.txt.text = songTitel[current_song - 1];
top.title._x = top.title_mask._x - 3;
} // end if
} // End of the function
_root.playlist == undefined ? (playlist = "mp3player.xml", playlist = "mp3player.xml") : (playlist = _root.playlist);
Stage.showMenu = false;
Stage.scaleMode = "noScale";
stop();
volume = 90;
current_song = 1;
top.equalizer._visible = 0;
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(playlist);
bot.list_bg.onEnterFrame = function ()
{
var _l1 = this;
if (hitTest(_root._xmouse, _root._ymouse, true) && _l1._parent.playlist._height > _l1._height)
{
ymin = _l1._y + _l1._height - _l1._parent.playlist._height;
ymax = _l1._y + 3;
conv = (_l1._ymouse - 15) * 1.300000 / _l1._height;
conv > 1 ? (conv = 1, conv = 1) : (null);
conv < 0 ? (conv = 0, conv = 0) : (null);
_l1._parent.playlist.easeY(ymax - conv * (ymax - ymin));
} // end if
};
bot.playlist.setMask(bot.list_bg);
play_btn.onRelease = function ()
{
playSong();
};
pause_btn.onRelease = function ()
{
this._visible = 0;
play_btn._visible = 1;
pausePos = MySound.position / 1000;
MySound.stop();
top.equalizer._visible = 0;
};
next_btn.onRelease = function ()
{
delete pausepos;
current_song == song_total ? (current_song = 1, current_song = 1) : (current_song++);
MySound.stop();
playSong();
};
prev_btn.onRelease = function ()
{
delete pausepos;
current_song == 1 ? (current_song = song_total, current_song = song_total) : (current_song--);
MySound.stop();
playSong();
};
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;
} // end if
this._rotation = this._rotation + 180;
};
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;
} // end if
this._rotation = this._rotation + 180;
};
drag_btn.onPress = function ()
{
startDrag(this._parent, false);
};
drag_btn.onRelease = drag_btn.onReleaseOutside = function ()
{
stopDrag();
};
copy.onPress = function ()
{
getURL("_blank");
};
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;
} // end if
if (top.trackDrag != true)
{
prozent = pos * 100 / dur;
top.track_play._xscale = prozent;
} // end if
};
top.track_back.onPress = function ()
{
var _l1 = this;
_l1._parent.trackDrag = true;
_l1._parent.track_play.onEnterFrame = function ()
{
var _l1 = this;
perc = (_l1._parent._xmouse - _l1._parent.track_back._x) / _l1._parent.track_back._width;
max = _l1._parent.track_load._width / _l1._parent.track_back._width;
perc > max ? (perc = max, perc = max) : (null);
perc < 0.010000 ? (perc = 0.010000, perc = 0.010000) : (null);
_l1._width = _l1._parent.track_back._width * perc;
_l1._parent._parent.pausePos = perc * _l1._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();
};
vol_back.onPress = function ()
{
vol_front.onEnterFrame = function ()
{
perc = (_xmouse - vol_back._x) / vol_back._width;
perc > 0.950000 ? (perc = 1, perc = 1) : (null);
perc < 0.050000 ? (perc = 0, 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);
top.equalizer.setMask(top.eq_mask);
top.equalizer.onEnterFrame = function ()
{
i++;
this.createEmptyMovieClip("graph" + i, i);
with (this["graph" + i])
{
_x = 0;
_y = 0;
beginFill(6710886, 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);
} // end of for
lineTo(j * 6, 0);
lineTo(0, 0);
endFill();
} // End of with
i >= 3 ? (i = 0, i = 0) : (null);
};
top.title.setMask(top.title_mask);
setInterval(scrollTitle, 40);
MovieClip.prototype.easeY = function (t)
{
var _l1 = this;
_l1.onEnterFrame = function ()
{
var _l1 = this;
_l1._y = int(t - (t - _l1._y) / 1.500000);
if (_l1._y > t - 1 && _l1._y < t + 1)
{
delete _l1["onEnterFrame"];
} // end if
};
}; 