Hallo Leute,
ich hab mal von einem Freund ein Musik Player bekommen, die er selbst programmiert hat, doch leider ist er gerade in den Ferien und kann mir nicht weiter helfen, deshalb wollte ich mich an euch wenden.
Und zwar will ich dass dieser Musik Player direkt am Anfang den Playlist lädt und von den Songs zufällig eins aussucht und wiedergibt?
Wäre froh wenn ihr mir weiterhelfen könntet.
Hier die Actionscript Codes:
PHP-Code:
function loadData(success)
{
this;
if (success)
{
showDisplay = this.firstChild.attributes.showDisplay;
if (showDisplay == "yes")
{
top.easeY(toppos);
topup = false;
display_btn._rotation = display_btn._rotation + 180;
}
showPlaylist = this.firstChild.attributes.showPlaylist;
if (showPlaylist == "yes")
{
bot.easeY(botpos);
botup = false;
list_btn._rotation = list_btn._rotation + 180;
}
aPath = new Array();
songTitel = new Array();
audioTracks = new Array();
audioTracks.shuffle();
audioTracks = this.firstChild.childNodes;
song_total = audioTracks.length;
var __reg1 = 0;
while (__reg1 < song_total)
{
aPath.push(audioTracks[__reg1].attributes.path);
songTitel.push(audioTracks[__reg1].attributes.title);
bot.playlist.btn.duplicateMovieClip("btn" + __reg1, __reg1);
bot.playlist["btn" + __reg1]._y = bot.playlist.btn._y + __reg1 * int(bot.playlist.btn._height) + __reg1;
bot.playlist["btn" + __reg1].txt = checkDigits(__reg1 + 1) + ". " + songTitel[__reg1];
bot.playlist["btn" + __reg1].hit.onPress = function ()
{
listClick(this._parent.getDepth() + 1);
}
;
++__reg1;
}
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;
}
}
}
}
delete audioTracks;
delete data_xml;
}
function listClick(prm)
{
delete pausepos;
current_song = prm;
MySound.stop();
playSong();
}
function playSong()
{
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++;
}
playSong();
}
;
top.track_load.onEnterFrame = function ()
{
this;
total = this._parent._parent.MySound.getBytesTotal();
geladen = this._parent._parent.MySound.getBytesLoaded();
if (geladen != total)
{
this._parent.load_display = Math.round(geladen * 100 / total) + "% Loaded";
this._xscale = Math.round(geladen * 100 / total);
return;
}
this._xscale = 100;
top.equalizer._visible = 1;
delete this.onEnterFrame;
delete this._parent.load_display;
}
;
}
play_btn._visible = 0;
pause_btn._visible = 1;
}
function checkDigits(toCheck)
{
var __reg1 = toCheck;
return __reg1 >= 10 ? __reg1 : (__reg1 = "0" + __reg1);
}
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._x = top.title_mask._x);
return;
}
top.title.txt.text = songTitel[current_song - 1];
top.title._x = top.title_mask._x - 3;
}
_root.playlist == undefined ? (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 ()
{
this;
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 ? null : (conv = 1);
conv >= 0 ? null : (conv = 0);
this._parent.playlist.easeY(ymax - conv * (ymax - ymin));
}
}
;
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++;
MySound.stop();
playSong();
}
;
prev_btn.onRelease = function ()
{
delete pausepos;
current_song == 1 ? (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;
}
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;
}
this._rotation = this._rotation + 180;
}
;
drag_btn.onPress = function ()
{
startDrag(this._parent, 0);
}
;
drag_btn.onRelease = drag_btn.onReleaseOutside = function ()
{
stopDrag();
}
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) + ":" +
}
// Habs mal hier abgekürzt sonst passt es nicht mit den Zeichen
Hier noch der XML Playlist Code, falls ihr es sehen wollt
PHP-Code:
<?xml version="1.0" encoding="UTF-8" ?>
<player showDisplay="yes" showPlaylist="yes" autoStart="yes">
<song path="(Musikpfad)" title="(Musiktitel)" />
<song path="(Musikpfad)" title="(Musiktitel)" />
<song path="(Musikpfad)" title="(Musiktitel)" />
<song path="(Musikpfad)" title="(Musiktitel)" />
<song path="(Musikpfad)" title="(Musiktitel)" />
<song path="(Musikpfad)" title="(Musiktitel)" />
<song path="(Musikpfad)" title="(Musiktitel)" />
</player>