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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| import flash.events.Event;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.media.SoundChannel;
var fl_SC:SoundChannel;
var fl_ToPlay:Boolean = true;
var oui_trouver:ColorTransform = new ColorTransform();
oui_trouver.color = 0x0000ff;
var non_trouver:ColorTransform = new ColorTransform();
non_trouver.color = 0x7a7a7a;
var i:int;
for (i = 1; i <= 15; i++)
{
var Chanel:Array = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"];
for (var l:String in Chanel)
{
this[Chanel[l]+(i)].label = (Chanel[l]+(i));
this[Chanel[l]+(i)].visible = false;
var this[Chanel[l]+(i)+"sound_verif"] :Sound= new Sound();
this[Chanel[l]+(i)+"sound_verif"].addEventListener(Event.COMPLETE, (Chanel[l]+(i)+"Complette"));
this[Chanel[l]+(i)+"sound_verif"].addEventListener(IOErrorEvent.IO_ERROR, (Chanel[l]+(i)+"Error"));
var this[Chanel[l]+(i)+"chemin"] :URLRequest = new URLRequest((dossier)+Chanel[l]+(i)+".mp3");
this[Chanel[l]+(i)+"sound_verif"].load((Chanel[l]+(i)+"chemin"));
function (Chanel[l]+(i)+"Complette")(event:Event):void
{
this[Chanel[l]+(i)].transform.colorTransform = oui_trouver;
}
function (Chanel[l]+(i)+"Error")(event:IOErrorEvent)
{
this[Chanel[l]+(i)].transform.colorTransform = non_trouver;
}
this[Chanel[l]+(i)].addEventListener(MouseEvent.CLICK, A1_play_stop);
function A1_play_stop(evt:MouseEvent):void
{
if(fl_ToPlay)
{
piste_en_cours.text = (Chanel[l]+(i));
loop_actif.visible = false;
loop_inactif.visible = true;
var s:Sound = new Sound(new URLRequest ((dossier)+Chanel[l]+(i)+".mp3"));
fl_SC = s.play();
if (loop_valeur == 1)
{
loop_actif.visible = true;
loop_inactif.visible = false;
fl_SC.addEventListener(Event.SOUND_COMPLETE, boucle);
function boucle(e:Event):void
{
fl_SC.removeEventListener(Event.SOUND_COMPLETE, boucle);
fl_SC = new SoundChannel();
fl_SC = s.play();
loop_actif.visible = false;
loop_inactif.visible = true;
if (loop_valeur == 1)
{
loop_actif.visible = true;
loop_inactif.visible = false;
fl_SC.addEventListener(Event.SOUND_COMPLETE, boucle);
}
}
}
}
else
{
fl_SC.stop();
piste_en_cours.text = (Arret);
if (loop_valeur == 1)
{
loop_actif.visible = true;
loop_inactif.visible = false;
}
if (loop_valeur == 0)
{
loop_actif.visible = false;
loop_inactif.visible = true;
}
}
fl_ToPlay = !fl_ToPlay;
}
}
} |
Partager