Donc voilà mon problème :
la lecture de mon mp3 démarre et le mp3 se charge en même temps, mais lorsque le chargement est terminé, au lieu que la lecture continue et que le morceau se termine, la lecture redémarre.
Voici mon code (récupéré sur un tuto) :
Action Script
barrePlaying._width = 0;
//var fichier = "son3.mp3";
var decalage = 0;
var charge = false;
var duree, si;
txt.text = "Tu veux jouer ?";
chanson = new Sound();
chanson.onSoundComplete = function() {
_root.arreter();
};
function arreter() {
chanson.stop();
clearInterval(si);
decalage = 0;
barrePlaying._width = 0;
_root.txt.text = "0/"+duree+" - 0%";
}
function pauser() {
clearInterval(si);
chanson.stop();
}
function majTxt() {
pc = Math.round((chanson.position*100)/chanson.duration);
txt.text = Math.round(chanson.position/1000)+"/"+duree;
txt.text += " - "+pc+"%";
barrePlaying._width = pc;
decalage = chanson.position/1000;
}
function jouer() {
if (charge == false) {
chanson.onLoad = function(ok) {
txt.text = "Chargement...";
if (ok=true) {
charge = true;
duree = Math.round(chanson.duration/1000);
txt.text = "0/"+duree+" - 0%";
chanson.start();
si = setInterval(majTxt, 1000);
}
};
chanson.loadSound(fichier, true);
} else {
chanson.start(decalage);
si = setInterval(majTxt, 1000);
}
}
_root.jouer();
Merci d'avance pour toute aide.
