1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| _root.jeux.stop();
barrePlaying._width = 0;
//var fichier = "son3.mp3";
var decalage = 0;
var charge = false;
var duree, si;
txt = "Push play";
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 = Math.round(chanson.position/1000)+"/"+duree;
txt += " - "+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);
}
} |
Partager