Looping Sound

Hi All -

I’m really hoping to get some help with looping sound… Here’s the code that I have - I don’t know what I"m doing wrong but the sound isn’t looping?? Thanks so much ahead of time!!

// Attach Music
var req:URLRequest = new URLRequest(“squeeak.mp3”);
var sound:Sound = new Sound();
var controller:SoundChannel;
var myTransform = new SoundTransform();

var soundLoop:int = int.MAX_VALUE;

myTransform.volume = 0.5;

var b:Boolean;

if(!b) {
b=true;

function soundLoaded(event:Event):void
{
controller = sound.play();

play_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);

}

function playSound(event:MouseEvent):void
{
controller = sound.play(soundLoop);
}

function stopSound(event:MouseEvent):void
{
controller.stop();
}

sound.addEventListener(Event.COMPLETE, soundLoaded);
sound.load(req);

}

Hi Ferrari_chris,

I actually got it to work by putting this code:

var controller:SoundChannel = new SoundChannel(); //added new SoundChannel

controller = sound.play(0,1000); // this in function

Thanks!

What’s the value of soundLoop when you trace it out?