- playlist_xml = new XML();
- playlist_xml.ignoreWhite = true;
- playlist_xml.onLoad = function(ok) {
- if (ok=true) {
- playliste = this.firstChild.childNodes;
- premiere = this.firstChild.firstChild;
- enCours = premiere;
- for (i=0; i<playliste.length; i++) {
- liste.addItem(enCours.attributes.num+"-"+enCours.attributes.nom, enCours.attributes.fichier);
- enCours = enCours.nextSibling;
- }
- }
- };
- playlist_xml.load("playlist.xml"); //localisation du fichier xml
- texte = "Sélectionnez un titre";
- textedefaut = "Sélectionnez un titre";
- lecture = 1; // 1:lit 1 fois, 2:lecture continue, 3:lecture aléatoire
- encoursdelecture = 0;
- titreencours = "";
- niveauson = 75;
- posichon=0;
-
- ziq = new Sound();
- ziq.onLoad = function(ok) {
- if (ok=true) {
- ziq.start();
- texte = liste.getSelectedItem().label;
- titreencours = texte;
- textedefaut = texte;
- } else {
- texte = "Problème au chargement.";
- deselection();
- }
- };
- liste.setSelectMultiple(false);
- liste.setChangeHandler("userClic");
-
- function userClic() {
- fichierEnCours = liste.getSelectedItem().data; // sélection du fichier audio
- vignetteEnCours = liste.getSelectedItem().label; // sélection de la vignette
- ziq.loadSound(fichierEnCours, false);
- vignette.attachMovie(vignetteEnCours, "vignette", 2);
- vignette._x=28;
- vignette._y=25;
- encoursdelecture = 1;
- chansonIntervale = setInterval(afficheTimer, 1000);
- }
- function deselection() {
- clearInterval(chansonIntervale);
- liste.setSelectedIndices(null);
- texte = "Musique arrêtée";
- }
-
- ziq.onSoundComplete = function() {
- if (lecture==2) {
- if (liste.getSelectedIndex() < liste.getLength() - 1) {
- liste.setSelectedIndex(liste.getSelectedIndex() + 1);
- }
- } else if (lecture==3) {
- quantite=liste.getLength();
- suivant=Math.ceil(quantite*Math.random());
- liste.setSelectedIndex(suivant-1);
- } else {
- texte = "Sélectionnez un titre";
- deselection();
- }
- }
-
- duree = 0;
- position_curseur = 1;
-
- // Définition des actions des boutons
-
- boutonPlay.onRelease = function() {
- ziq.start(posichon, 1);
- chansonIntervale = setInterval(afficheTimer, 1000);
- }
-
- boutonPause.onRelease = function() {
- chansonPosition = Math.round(ziq.position/1000);
- clearInterval(chansonIntervale);
- ziq.stop();
- texte = liste.getSelectedItem().label+" en pause";
- }
-
- boutonStop.onRelease = function() {
- ziq=new Sound();
- deselection();
- encoursdelecture=0;
- texte = "Musique arrêtée";
- }
-
- boutonSuivant.onRelease = function() {
- if ((lecture==1) or (lecture==2)) {
- if (liste.getSelectedIndex() < liste.getLength() - 1) {
- liste.setSelectedIndex(liste.getSelectedIndex() + 1);
- }
- } else if (lecture==3) {
- quantite=liste.getLength();
- trace ("quantité="+quantite);
- suivant=Math.ceil(quantite*Math.random());
- trace ("suivant="+suivant);
- liste.setSelectedIndex(suivant-1);
- }
- }
-
- boutonPrecedent.onRelease = function() {
- if (liste.getSelectedIndex() > 0) {
- liste.setSelectedIndex(liste.getSelectedIndex() - 1);
- }
- }
-
- boutonRecule.onRelease = function() {
- ziq.stop()
- posichon-=10;
- ziq.start(posichon, 1);
- }
-
- boutonAvance.onRelease = function() {
- ziq.stop()
- posichon+=10;
- ziq.start(posichon, 1);
- }
-
- bouton1fois.onRelease = function() {
- lecture=1;
- }
-
- boutonContinue.onRelease = function() {
- lecture=2;
- }
-
- boutonAleatoire.onRelease = function() {
- lecture=3;
- }
playlist_xml = new XML();
playlist_xml.ignoreWhite = true;
playlist_xml.onLoad = function(ok) {
if (ok=true) {
playliste = this.firstChild.childNodes;
premiere = this.firstChild.firstChild;
enCours = premiere;
for (i=0; i<playliste.length; i++) {
liste.addItem(enCours.attributes.num+"-"+enCours.attributes.nom, enCours.attributes.fichier);
enCours = enCours.nextSibling;
}
}
};
playlist_xml.load("playlist.xml"); //localisation du fichier xml
texte = "Sélectionnez un titre";
textedefaut = "Sélectionnez un titre";
lecture = 1; // 1:lit 1 fois, 2:lecture continue, 3:lecture aléatoire
encoursdelecture = 0;
titreencours = "";
niveauson = 75;
posichon=0;
ziq = new Sound();
ziq.onLoad = function(ok) {
if (ok=true) {
ziq.start();
texte = liste.getSelectedItem().label;
titreencours = texte;
textedefaut = texte;
} else {
texte = "Problème au chargement.";
deselection();
}
};
liste.setSelectMultiple(false);
liste.setChangeHandler("userClic");
function userClic() {
fichierEnCours = liste.getSelectedItem().data; // sélection du fichier audio
vignetteEnCours = liste.getSelectedItem().label; // sélection de la vignette
ziq.loadSound(fichierEnCours, false);
vignette.attachMovie(vignetteEnCours, "vignette", 2);
vignette._x=28;
vignette._y=25;
encoursdelecture = 1;
chansonIntervale = setInterval(afficheTimer, 1000);
}
function deselection() {
clearInterval(chansonIntervale);
liste.setSelectedIndices(null);
texte = "Musique arrêtée";
}
ziq.onSoundComplete = function() {
if (lecture==2) {
if (liste.getSelectedIndex() < liste.getLength() - 1) {
liste.setSelectedIndex(liste.getSelectedIndex() + 1);
}
} else if (lecture==3) {
quantite=liste.getLength();
suivant=Math.ceil(quantite*Math.random());
liste.setSelectedIndex(suivant-1);
} else {
texte = "Sélectionnez un titre";
deselection();
}
}
duree = 0;
position_curseur = 1;
// Définition des actions des boutons
boutonPlay.onRelease = function() {
ziq.start(posichon, 1);
chansonIntervale = setInterval(afficheTimer, 1000);
}
boutonPause.onRelease = function() {
chansonPosition = Math.round(ziq.position/1000);
clearInterval(chansonIntervale);
ziq.stop();
texte = liste.getSelectedItem().label+" en pause";
}
boutonStop.onRelease = function() {
ziq=new Sound();
deselection();
encoursdelecture=0;
texte = "Musique arrêtée";
}
boutonSuivant.onRelease = function() {
if ((lecture==1) or (lecture==2)) {
if (liste.getSelectedIndex() < liste.getLength() - 1) {
liste.setSelectedIndex(liste.getSelectedIndex() + 1);
}
} else if (lecture==3) {
quantite=liste.getLength();
trace ("quantité="+quantite);
suivant=Math.ceil(quantite*Math.random());
trace ("suivant="+suivant);
liste.setSelectedIndex(suivant-1);
}
}
boutonPrecedent.onRelease = function() {
if (liste.getSelectedIndex() > 0) {
liste.setSelectedIndex(liste.getSelectedIndex() - 1);
}
}
boutonRecule.onRelease = function() {
ziq.stop()
posichon-=10;
ziq.start(posichon, 1);
}
boutonAvance.onRelease = function() {
ziq.stop()
posichon+=10;
ziq.start(posichon, 1);
}
bouton1fois.onRelease = function() {
lecture=1;
}
boutonContinue.onRelease = function() {
lecture=2;
}
boutonAleatoire.onRelease = function() {
lecture=3;
}