Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvar temps = 0; var total = 0; var resultat = 0; // Gestion du XML 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++) { // trace ("num="+enCours.attributes.num+", nom="+enCours.attributes.nom+", fichier="+enCours.attributes.fichier+"."); liste.addItem(enCours.attributes.num + ": " + enCours.attributes.nom, enCours.attributes.fichier); enCours = enCours.nextSibling; } } }; playlist_xml.load("playlist.xml"); // // Gestion du chargement des mp3s // chanson = new Sound(); chanson.onLoad = function(ok) { if (ok = true) { chanson.start(); _root.ecranTitre = liste.getSelectedItem().data; titrejoue = liste.getSelectedItem().data; timer.onLoad = function () { volumechanger.setVolume(_root.volume); } timer.onEnterFrame = function () { volumechanger.setVolume(_root.volume ); temps = chanson.position; total = chanson.duration; resultat = Math.floor((temps/total)*100); volumechanger.setVolume(_root.volume ); timesec = Math.floor(temps/1000)-60*tpsmin; // temps en secondes if(timesec<10){ // ajout du 0 tpssec = "0"+timesec; }else if(timesec>10){ tpssec = timesec; } timetotsec =Math.floor(total/1000)-60*totmin; if(timetotsec<10){ // ajout du 0 totsec = "0"+timetotsec; }else if(timetotsec>10){ totsec = timetotsec; } timetpsmilli = temps-Math.floor(temps/1000)*1000;// en millisecondes if(timetpsmilli<100){ // ajout du 0 tpsmilli = "0"+timetpsmilli; }else if(timetpsmilli>100){ tpsmilli = timetpsmilli; } timetotmilli = total-Math.floor(total/1000)*1000; if(timetotmilli<10){ // ajout du 0 totmilli = "00"+timetotmilli; }else if(timetotmilli>10 && timetotmilli<100){ totmilli = "0"+timetotmilli; }else{ totmilli = timetotmilli; } timetpsmin = Math.floor(temps/1000/60); // en minutes if(timetpsmin<10){ // ajout du 0 tpsmin = "0"+timetpsmin; }else if(timetpsmin>10){ tpsmin = timetpsmin; } timetotmin = Math.floor(total/1000/60); if(timetotmin<10){ // ajout du 0 totmin = "0"+timetotmin; }else if(timetotmin>10){ totmin =timetotmin ; } } } else { _root.ecranTitre = "...Problème au chargement..."; deselection(); } }; _root.chanson.onSoundComplete = function() { _root.ecranTitre = "...Chanson terminée..."; fichiersuivant = fichierEnCours.getSelectedIndex(); //fichier = new String(liste.getSelectedItem().label); //numerofichier = fichier.slice(0,2); //numsuiv =new Number(numerofichier)+1; //fichiersuivant = new String (numsuiv+":"); trace(fichiersuivant); //if (fichiersuivant = "undefined"){ //fichiersuivant = new String(1:); //}else{ //_root.chanson.loadSound(fichierEnCours, true); //} }; // // Gestion du clic dans la liste // _root.liste.setSelectMultiple(false); _root.liste.setChangeHandler("userClic"); function userClic() { fichierEnCours = liste.getSelectedItem().data; _root.chanson.loadSound(fichierEnCours, true); } function deselection() { _root.liste.setSelectedIndices(null); } // gestion des boutons test = 0; _root.arret.onPress = function() { stopAllSounds(); _root.ecranTitre = "...Arret exécuté..."; test = 0; duree = 0; } _root.lancement.onPress = function() { if (test = 1) { chanson.start(duree,0); _root.ecranTitre = titrejoue test = 0; }else{ chanson.start(); _root.ecranTitre = titrejoue; resultat = 0; } } _root.pose.onPress = function() { chanson.stop(); duree = chanson.position/1000; test = 1; _root.ecranTitre = "...Mise en pause..."; } _root.retour.onPress = function() { duree = Math.round(chanson.position/1000); chanson.stop(); _root.ecranTitre = "...Retour de 15 secondes..."; } _root.retour.onRelease = function() { chanson.start(duree-15,0); _root.ecranTitre = titrejoue; } _root.avance.onPress = function() { duree = Math.round(chanson.position/1000); chanson.stop(); _root.ecranTitre = "...Avance de 15 secondes..."; } _root.avance.onRelease = function() { chanson.start(duree+15,0); _root.ecranTitre = titrejoue; } // gestion du volume increment = 4; level1 = 0; volume = 50; slider.onPress = function() { if (Key.isDown(Key.getCode(18))) { autoPan = true; } else { autoPan = false; start = _root._xmouse; newStart = slider._rotation; dragging = true; } }; slider.onRelease = function() { dragging = false; }; slider.onReleaseOutside = function() { dragging = false; }; // this.onEnterFrame = function() { if (dragging) { pivot = (_root._xmouse-start)*2+newStart; slider._rotation = pivot; if (pivot<-135) { slider._rotation = -135; } if (pivot>135) { slider._rotation = 135; } if (volume<=8 && volume != 0){ couleur8._alpha = 100 } _root.level1 = Math.round(slider._rotation/2.7); _root.volume = Math.round(level1+50); } else { if (autoPan) { _root.textInput.value.selectable = false; level1 += increment; _root.volume = Math.round(level1+50); if (level1>49 || level1<-49) { increment *= -1; } } else { _root.textInput.value.selectable = true; } if (level1>50) { level1 = 50; _root.volume = Math.round(level1+50); } else if (level<-50) { level1 = -50; _root.volume = Math.round(level1+50); } else if (level1<=50 && level1>=-50) { _root.slider._rotation = level1*2.7; _root.volume = Math.round(level1+50); } } _root.volumechanger.setVolume(volume); };