Zurück   Flashforum > Flash > Flash Einsteiger

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 30-07-2008, 09:13   #1 (permalink)
Neuer User
 
Benutzerbild von S-MJ
 
Registriert seit: Oct 2007
Beiträge: 15
Question XML Playlist Zufällige Wiedergabe im Musik Player

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(pausePos0);
        
pausePos 0;
    }
    else 
    {
        
MySound = new Sound();
        
MySound.setVolume(volume);
        
MySound.loadSound(AudioPathtrue);
        
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 >= 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._ymousetrue) && 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 <= null : (conv 1);
        
conv >= 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 == ? (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._parent0);
}
;
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>
__________________
Mit freundlichen Grüßen

by S-MJ

Geändert von S-MJ (30-07-2008 um 13:04 Uhr)
S-MJ ist offline   Mit Zitat antworten
Alt 30-07-2008, 09:29   #2 (permalink)
tux
flashback
 
Benutzerbild von tux
 
Registriert seit: Aug 2003
Beiträge: 529
hm...
ändere mal
ActionScript:
  1. AudioPath = aPath[current_song - 1];
in
ActionScript:
  1. AudioPath = aPath[random (aPath.length)];
__________________
Zitat:
Zitat von forennuterzname ist der redaktion bekannt
"Das ist ein guter Tipp mit dem Googlen."
SPAM Headline of the week: "Fipsiger Zeitaufwand, der Zaster bringt"
tux ist offline   Mit Zitat antworten
Alt 30-07-2008, 09:34   #3 (permalink)
Neuer User
 
Benutzerbild von S-MJ
 
Registriert seit: Oct 2007
Beiträge: 15
Cool

Vielen Dank das hat jetzt super geklappt aber nur am Anfang , nur jetzt wird noch jedes mal der Musiktitel vom ersten Lied gezeigt und nicht von den momentanen Lied und wenn ich ein anderes Lied anklicke manuell dann wird auch zufällig eins ausgewählt und nicht das angeklickte lied
__________________
Mit freundlichen Grüßen

by S-MJ

Geändert von S-MJ (30-07-2008 um 09:39 Uhr)
S-MJ ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 03:40 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele