//**********************************************************************************************************************************************************// //***************************************************////////////////////////////////////////////////*******************************************************// //***************************************************//// Lecteur mp3 / François Reme - 2008 //////*******************************************************// //***************************************************////////////////////////////////////////////////*******************************************************// //**********************************************************************************************************************************************************// // // ------ Utilisaton : // // 1 : placer le fichier MP3.as dans le meme répertoire que votre .fla. // 2 : créez les boutons : play, pause, stop, suivant, precédent et DONNEZ LEURS DES NOMS D'OCCURENCES // 3 : placer le code suivant dans le clip contenant vos boutons /* // // var lecteur = new MP3("chemin_du_repertoire_contenant_les_pistes", chemin_bouton_play, chemin_bouton_stop, chemin_bouton_pause, chemin_bouton_précédente, chemin_bouton_suivante, chemin_champ_de texte); // // */ class MP3 { function MP3(path:String, TL:MovieClip, TS:MovieClip, TP:MovieClip, TPR:MovieClip, TN:MovieClip, TT:TextField) { var temp = 0; var id:Number; var posiSec:Number = 0; var Pteur:Number = 1; var loader:LoadVars = new LoadVars(); var Son:Sound = new Sound(); var pistes:Array = []; //pistes.push("") loader.onLoad = function(success) { if (success) { for (var i = 1; i<(Number(this.nombre_de_titres)+1); i++) { pistes[i] = this["url"+i]; trace(pistes); } TL.onPress = function() { posiSec = Son.position/1000; if (posiSec == 0) { Son.loadSound(path+"/"+pistes[Pteur], true); } else { Son.start(posiSec, 0); } }; TS.onPress = function() { Son.stop(); posiSec = 0; }; TP.onPress = function() { posiSec = Son.position/1000; Son.stop(); }; TPR.onPress = function() { temp = 0; id = setInterval(function () { if (temp>=10) { Son.start(Son.position/1000-5, 0); } temp += 5; }, 300); }; TPR.onRelease = TPR.onReleaseOutside=function () { clearInterval(id); if (temp<=10) { if (Pteur>=1) { Pteur--; } else { Pteur = loader.nombre_de_titres; } Son.loadSound(path+"/"+pistes[Pteur], true); } }; TN.onPress = function() { temp = 0; id = setInterval(function () { if (temp>=10) { Son.start(Son.position/1000+5, 0); } temp += 5; }, 300); }; TN.onRelease = TN.onReleaseOutside=function () { clearInterval(id); if (temp<=10) { if (Pteur