Bonjour a tous,
Etant étudiant, je cherche à créer un player audio en flash grace a du xml.
J'ai créé mon xml dans ce genre :
<artiste>
<song>sound/pouet.mp3</song>
</artiste>
J'ai ensuite fait mon player, mais j'ai un probleme avec mon bouton suvant ou precedant, je recois l'erreur "Error #2037: Vous avez appelé les fonctions dans un ordre incorrect ou un appel antérieur a échoué."
Voici la partie du code concernant mes deux boutons next et previous :
function nextsong(me:MouseEvent):void{
if(encours<songtotal)
{
sc.stop();
zik.load(new URLRequest(monxml.artiste[encours+1].song));
sc.addEventListener(Event.SOUND_COMPLETE,playsong);
}
else
{
sc.stop();
zik.load(new URLRequest(monxml.artiste[1].song));
sc.addEventListener(Event.SOUND_COMPLETE,playsong);
encours=1;
}
}
function playsong(e:Event):void{
sc=zik.play(0,1);
}
function prevsong(me:MouseEvent):void{
if(encours<1)
{
sc.stop();
zik.load(new URLRequest(monxml.artiste[encours-1].song));
sc.addEventListener(Event.SOUND_COMPLETE,playsong);
}
else
{
sc.stop();
zik.load(new URLRequest(monxml.artiste[songtotal].song));
sc.addEventListener(Event.SOUND_COMPLETE,playsong);
encours=songtotal;
}
}
Precisions : encours est l'indice de la chanson en cours, songtotal est le nombre de chanson qu'il y a dans le xml, sc le SoundChannel, zik le Sound.
Voyez vous l'erreur?
Merci d'avance.