Hey, I have the following code:
var liga_som:URLRequest = new URLRequest("som/som.mp3");
var som:Sound = new Sound();
var controla_som:SoundChannel = new SoundChannel();
var tempo:Number = 0;
som.load(liga_som);
som.addEventListener(Event.COMPLETE, onCompleto);
function onCompleto(event:Event):void
{
boneco.pausa_btn.addEventListener(MouseEvent.CLICK, pausa_som);
controla_som = som.play(tempo);
}
function toca_som(event:MouseEvent):void
{
controla_som = som.play(tempo);
boneco.play_btn.visible = false;
boneco.play_btn.removeEventListener(MouseEvent.CLICK, toca_som);
boneco.pausa_btn.visible = true;
boneco.pausa_btn.addEventListener(MouseEvent.CLICK, pausa_som);
}
function pausa_som(event:MouseEvent):void
{
controla_som.stop();
tempo = controla_som.position;
boneco.pausa_btn.visible = false;
boneco.pausa_btn.removeEventListener(MouseEvent.CLICK, pausa_som);
boneco.play_btn.visible = true;
boneco.play_btn.addEventListener(MouseEvent.CLICK, toca_som);
}
But I’d like to have an infinite loop, how can I do that?
Tks