Comunidad de diseño web y desarrollo en internet online

crear un flash audio player

Citar            
MensajeEscrito el 06 Oct 2007 08:09 pm
hola amigos, estoy hace unos dia investigando y tratando de hacer un flash audioplayer
asi como lo tienen las web de atevip, y tantas otras utilizando un player.swf y leyendo un audiolist.xml
pero ahora estoy tratando de hacer que un reproductor parecido lee un xml dinamico, osea con un php "lista.php"


espero que me ayuden, ya logre generar mi lista.php
pero el problema es que no actualiza mi reproductor la lista dinamica nueva generada
aqui esta el codigo
gracias de antemano
:: llama la lista dinamica

Código :

onClipEvent (construct)
{
    playlist = "lista.php";
    status = "Status: Loading";
    playatstart = true;
    playerlook = true;
    StreamSignal = true;
}

y aqui la lista que genera el audio player

function ladeDaten(success)
{
    if (success)
    {
        aPath = new Array();
        songTitel = new Array();
        songArtist = new Array();
        songCover = new Array();
        audioTracks = new Array();
        audioTracks = this.firstChild.childNodes;
        totalAudio = audioTracks.length;
        for (var _loc2 = 0; _loc2 < totalAudio; ++_loc2)
        {
            if (audioTracks[_loc2].nodeName == "song")
            {
                aPath.push(audioTracks[_loc2].attributes.path);
                songTitel.push(audioTracks[_loc2].attributes.title);
                songArtist.push(audioTracks[_loc2].attributes.artist);
                songCover.push(audioTracks[_loc2].attributes.bild);
            } // end if
        } // end of for
        AudioPath = aPath[0];
        titel = songTitel[0];
        artist = songArtist[0];
        aktAudio = 1;
        trackAnzeige = aktAudio + " / " + totalAudio;
        status = "Status: Cargando la Lista de Musicas";
        if (playerlook)
        {
            setCover(0);
        } // end if
        erstesBild = true;
        setzeDirektwahl();
        setzePlaylistwahl();
        if (playatstart)
        {
            playSong();
        } // end if
    }
    else
    {
        status = "Status: PlayList - Not loaded";
    } // end else if
    delete audioTracks;
    delete data_xml;
} // End of the function
function setCover(pNr)
{
    if (_currentframe == 2 || !erstesBild)
    {
        cover_mc.loadMovie(songCover[pNr], 1);
    } // end if
} // End of the function
function ruck(diff)
{
    pausgabe = MySound.position - diff;
    MySound.stop();
    MySound.start(pausgabe / 1000, 0);
} // End of the function
function vor(diff)
{
    pausgabe = MySound.position + diff;
    MySound.stop();
    MySound.start(pausgabe / 1000, 0);
} // End of the function
function playSong()
{
    if (pauseSignal == true)
    {
        MySound.start(pausePos, 0);
        pauseSignal = false;
        playSignal = true;
        delete pausePos;
        kugel_mc._visible = 1;
    }
    else
    {
        MySound = new Sound();
        if (volstatus < volume)
        {
            volume = volstatus;
        }
        else if (volstatus > volume)
        {
            volume = volstatus;
        }
        else if (volstatus == 100)
        {
            volume = 100;
        } // end else if
        if (balstatus < balance)
        {
            balance = balstatus;
        }
        else if (balstatus > balance)
        {
            balance = balstatus;
        }
        else if (balstatus == 0)
        {
            balance = 0;
        } // end else if
        MySound.loadSound(AudioPath, StreamSignal);
        MySound.setVolume(volume);
        MySound.setPan(balance);
        MySound.onSoundComplete = function ()
        {
            if (playrepeat)
            {
                playSong();
            }
            else
            {
                nextTrack();
                playSong();
            } // end else if
        };
        volstatus = volume;
        balstatus = balance;
        pauseSignal = false;
        playSignal = true;
        wahlSignal = false;
        _parent.onEnterFrame = function ()
        {
            total = MySound.getBytesTotal();
            geladen = MySound.getBytesLoaded();
            if (geladen != total)
            {
                if (geladen != undefined && total != undefined)
                {
                    status = "Status: " + Math.round(geladen * 100 / total) + "% Cargando";
                } // end if
                mc._xscale = Math.round(geladen * 100 / total);
            }
            else
            {
                status = "Status: playing -100% Cargado";
                delete _parent.onEnterFrame;
                kugel_mc._visible = 1;
                if (!StreamSignal)
                {
                    MySound.start(0, 0);
                } // end if
            } // end else if
        };
    } // end else if
} // End of the function
function nextTrack()
{
    if (aktAudio < totalAudio)
    {
        aktAudio = aktAudio + 1;
        AudioPath = aPath[aktAudio - 1];
        titel = songTitel[aktAudio - 1];
        artist = songArtist[aktAudio - 1];
        MySound.stop();
        playSignal = 0;
        pauseSignal = 0;
        wahlSignal = 1;
        delete pausePos;
        kugel_mc._visible = 0;
        trackAnzeige = aktAudio + " / " + totalAudio;
        status = "Status: stopped - press play";
        setCover(aktAudio - 1);
    } // end if
} // End of the function
function prevTrack()
{
    if (aktAudio > 1)
    {
        aktAudio = aktAudio - 1;
        AudioPath = aPath[aktAudio - 1];
        titel = songTitel[aktAudio - 1];
        artist = songArtist[aktAudio - 1];
        MySound.stop();
        playSignal = 0;
        pauseSignal = 0;
        wahlSignal = 1;
        delete pausePos;
        kugel_mc._visible = 0;
        trackAnzeige = aktAudio + " / " + totalAudio;
        status = "Status: stopped - press play";
        setCover(aktAudio - 1);
    } // end if
} // End of the function
function checkDigits(pWert)
{
    var _loc1 = pWert;
    return (_loc1 < 10 ? (_loc1 = "0" + _loc1, "0" + _loc1) : (_loc1));
} // End of the function
function sBalken(obj)
{
    prozent = _global.position * 100 / _global.dauer;
    this[obj]._xscale = prozent;
    prozent = parseInt(prozent) + "%";
} // End of the function
function setzeDirektwahl()
{
    var _loc3 = this;
    for (var _loc2 = 1; _loc2 <= 12; ++_loc2)
    {
        _loc3["dw" + _loc2 + "_btn"].nrtxt = _loc2;
        if (_loc2 > totalAudio)
        {
            _loc3["dw" + _loc2 + "_btn"].nr_txt.text = "--";
        } // end if
    } // end of for
} // End of the function
function setzeAudiowahl(pAkt)
{
    aktAudio = pAkt;
    AudioPath = aPath[aktAudio - 1];
    titel = songTitel[aktAudio - 1];
    artist = songArtist[aktAudio - 1];
    MySound.stop();
    playSignal = 0;
    pauseSignal = 0;
    wahlSignal = 1;
    delete pausePos;
    kugel_mc._visible = 0;
    trackAnzeige = aktAudio + " / " + totalAudio;
    status = "Status: stopped - press play";
    setCover(aktAudio - 1);
    playSong();
} // End of the function
function setzePlaylistwahl()
{
    playauswahl.playliste = "";
    for (var _loc1 = 1; _loc1 <= aPath.length; ++_loc1)
    {
        playauswahl.playliste = playauswahl.playliste + ("<a href=\'asfunction:playauswahl," + _loc1 + "\'><font color=\'#FF0000\'>" + _loc1 + ":</font><font color=\'#FFFFFF\'> " + songTitel[_loc1 - 1].substr(0, 500) + "</a></font><br>");
    } // end of for
} // End of the function
function playlistauswahl(pAkt)
{
    aktAudio = int(pAkt);
    AudioPath = aPath[aktAudio - 1];
    titel = songTitel[aktAudio - 1];
    artist = songArtist[aktAudio - 1];
    MySound.stop();
    playSignal = 0;
    pauseSignal = 0;
    wahlSignal = 1;
    delete pausePos;
    kugel_mc._visible = 0;
    trackAnzeige = aktAudio + " / " + totalAudio;
    status = "Status: stopped - press play";
    setCover(aktAudio - 1);
    playSong();
} // End of the function
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = ladeDaten;
data_xml.load(playlist);
volume = 100;
balance = 0;
play_btn.onRelease = function ()
{
    playSong();
};
play_btn.onRollOver = function ()
{
    status = "Status: load / play song";
};
play_btn.onRollOut = function ()
{
    status = playSignal ? (status = "Status: playing") : (status = "Status: stopped");
};
stop_btn.onRelease = function ()
{
    MySound.stop();
    playSignal = 0;
    delete pausePos;
    kugel_mc._visible = 0;
};
stop_btn.onRollOver = function ()
{
    status = "Status: stop playing";
};
stop_btn.onRollOut = function ()
{
    status = !playSignal ? (status = "Status: stopped") : (status = "Status: playing");
};
pause_btn.onRelease = function ()
{
    if (!wahlSignal)
    {
        pausePos = MySound.position / 1000;
        MySound.stop();
        pauseSignal = true;
        playSignal = false;
        kugel_mc._visible = 0;
        status = "Status: press play";
    } // end if
};
pause_btn.onRollOver = function ()
{
    status = !pauseSignal ? (status = "Status: pause playing") : (status = "Status: press play");
};
pause_btn.onRollOut = function ()
{
    status = !playSignal ? (status = "Status: stopped") : (status = "Status: playing");
};
next_btn.onRelease = function ()
{
    if (aktAudio < totalAudio)
    {
        nextTrack();
        playSong();
    } // end if
};
next_btn.onRollOver = function ()
{
    dstatus = status;
    status = "Status: load next song";
};
next_btn.onRollOut = function ()
{
    if (status != "Status: stopped - press play")
    {
        status = dstatus;
    } // end if
};
prev_btn.onRelease = function ()
{
    if (aktAudio > 1)
    {
        prevTrack();
        playSong();
    } // end if
};
prev_btn.onRollOver = function ()
{
    dstatus = status;
    status = "Status: load prev song";
};
prev_btn.onRollOut = function ()
{
    if (status != "Status: stopped - press play")
    {
        status = dstatus;
    } // end if
};
zeit_btn.onRelease = function ()
{
    zeitSignal = !zeitSignal;
};
zeit_btn.onRollOver = function ()
{
    dstatus = status;
    status = "Status: Total / " + t_TrackZeit.total + " - switch timedisplay ";
};
zeit_btn.onRollOut = function ()
{
    status = dstatus;
};
drag_btn.onPress = function ()
{
    startDrag (this._parent, false);
};
drag_btn.onRelease = drag_btn.onReleaseOutside = function ()
{
    stopDrag ();
};
drag_btn.onRollOver = function ()
{
    dstatus = status;
    status = "Status: drag \'n\' drop";
};
drag_btn.onRollOut = function ()
{
    status = dstatus;
};
look_btn.onPress = function ()
{
    if (_currentframe == 2)
    {
        cover_mc._visible = 0;
        gotoAndStop(3);
    }
    else
    {
        cover_mc._visible = 1;
        gotoAndStop(2);
        setzeDirektwahl();
        setzePlaylistwahl();
        setCover(aktAudio - 1);
    } // end else if
};
look_btn.onRollOver = function ()
{
    dstatus = status;
    status = "Status: change look - simple/extended";
};
look_btn.onRollOut = function ()
{
    status = dstatus;
};
fslogo_btn.onPress = function ()
{
    fslogo_mc._visible = !fslogo_mc._visible;
};
fslogo_btn.onRollOver = function ()
{
    dstatus = status;
    status = "Status: player - credits";
};
fslogo_btn.onRollOut = function ()
{
    status = dstatus;
};
fslogo_mc._visible = 0;
fslogo_mc.onRelease = function ()
{
    getURL("http://ATeMusic.Ya.ST", "_blank");
};
kugel_mc._visible = 0;
onEnterFrame = function ()
{
    var _loc2 = _global;
    _loc2.dauer = int(MySound.duration / 1000);
    _loc2.position = int(MySound.position / 1000);
    t_TrackZeit = {};
    t_TrackZeit.minutes = int(_loc2.dauer / 60);
    t_TrackZeit.seconds = int(_loc2.dauer % 60);
    t_TrackZeit.total = checkDigits(t_TrackZeit.minutes) + ":" + checkDigits(t_TrackZeit.seconds);
    b_TrackZeit = {};
    b_TrackZeit.minutes = int(_loc2.position / 60);
    b_TrackZeit.seconds = int(_loc2.position % 60);
    b_TrackZeit.total = checkDigits(b_TrackZeit.minutes) + ":" + checkDigits(b_TrackZeit.seconds);
    n_TrackZeit = {};
    n_TrackZeit.minutes = int((_loc2.dauer - _loc2.position) / 60);
    n_TrackZeit.seconds = int((_loc2.dauer - _loc2.position) % 60);
    n_TrackZeit.total = checkDigits(n_TrackZeit.minutes) + ":" + checkDigits(n_TrackZeit.seconds);
    sBalken("smc");
    if (zeitSignal)
    {
        display = n_TrackZeit.total;
    }
    else
    {
        display = b_TrackZeit.total;
    } // end else if
    if (trackDrag != true)
    {
        regler_mc._x = MySound.position / MySound.duration * sliderMax;
    } // end if
};
MovieClip.prototype.dClick = function (tempo)
{
    var _loc2 = this;
    ASSetPropFlags(_loc2, ["clickZeit"], 1);
    if (_loc2.clickZeit - (_loc2.clickZeit = getTimer()) + tempo > 0)
    {
        return (true);
    } // end if
};
if (!playerlook)
{
    gotoAndStop(3);
} // end if
trackDrag = false;
sliderMax = bigdisplay_mc._width;
regler_mc.onPress = function ()
{
    var _loc2 = this;
    if (_loc2._parent.MySound)
    {
        trackDrag = true;
        startDrag (_loc2, false, 0, _loc2._y, sliderMax, _loc2._y);
        _loc2._parent.onMouseMove = function ()
        {
            updateAfterEvent();
        };
    } // end if
};
regler_mc.onRelease = regler_mc.onReleaseOutside = function ()
{
    var _loc2 = this;
    if (_loc2._parent.MySound)
    {
        trackDrag = false;
        delete _loc2._parent.onMouseMove;
        stopDrag ();
        neuePosition = _loc2._x * (MySound.duration / 1000) / sliderMax;
        pausePos = neuePosition;
        MySound.stop();
        MySound.start(neuePosition, 0);
        kugel_mc._visible = 1;
        status = "Status: playing";
        dstatus = status;
        playSignal = true;
        pauseSignal = false;
    } // end if
};
regler_mc.onRollOver = function ()
{
    dstatus = status;
    status = "Status: Drag Slider";
};
regler_mc.onRollOut = function ()
{
    status = dstatus;
};
repeat_mc._visible = 0;
repeat_btn.onRelease = function ()
{
    playrepeat = !playrepeat;
    repeat_mc._visible = playrepeat;
};
repeat_btn.onRollOver = function ()
{
    dstatus = status;
    status = "Status: repeat track";
};
repeat_btn.onRollOut = function ()
{
    status = dstatus;
};


suerte// byadicto

Por byperu

1 de clabLevel



 

msie
Citar            
MensajeEscrito el 07 Oct 2007 01:42 am
Cuando cargas el XML, se guarda en la caché, y al pedirlo otra vez te devuelve el mismo.

Para solucionarlo, tendrías que cargarlo así:

Código :

var myXml:XML = "tuarchivo.php?nocache="+random(99999);


pd: la próxima usa las etiquetas code, y trata de poner solo el código relevante a tu problema.

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 07 Oct 2007 10:04 pm
gracias por la sugerencia de no dejar en la cache mi lista.

Código :

var myXml:XML = "tuarchivo.php?nocache="+random(99999);

pero la idea es lograr cambiar la lista a partir de una busqueda que esta dentro del reproductor.swf
osea mediante un formulario haria una consulta en un lista.php el cual devolveria un xml que de nuevo leeria el reproductor.swf

no si habria una forma de lograr eso, gracias de antemano

Por byperu

1 de clabLevel



 

msie
Citar            
MensajeEscrito el 07 Oct 2007 10:21 pm
osea mediante un formulario haria una consulta en un lista.php el cual devolveria un xml que de nuevo leeria el reproductor.swf

pues esa es la solucion. tu mismo la estas diciendo.

Por DiegoAzul

376 de clabLevel



 

Mx

firefox
Citar            
MensajeEscrito el 07 Oct 2007 10:24 pm
por cierto tu hiciste el codigo o lo bajaste?, ese codigo me parece haberlo visto en otro lugar.

Por DiegoAzul

376 de clabLevel



 

Mx

firefox
Citar            
MensajeEscrito el 07 Oct 2007 10:55 pm
no comprendo bien, mi lista.php genera un echo 'xml'
pero basicamente no se como actualizar mi reproductor para que cambien la lista.

.por sierto este codigo estoy trabajando en base a esta direccion
http://forum.flashhilfe.de/forum/flash/flash-audioplayer-hilfe-213046-213046.html

ademas cuando lo termine pondre a disposion de todos, considero que la informacion debe ser libre.

Por byperu

1 de clabLevel



 

msie

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.