ConfusedDreamweaverUser ConfusedDreamweaverUser - 7 months ago 78
ActionScript Question

Looping sound in AS3

Trying to loop a background soundtrack while my flash program is in use.

So far my code is this:

//turn off sound
btnOff.addEventListener(MouseEvent.CLICK, fl_stopsound);

function fl_stopsound(event:MouseEvent):void

//turns sound on
btnOn.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound_1);

var fl_SC_1:SoundChannel;

//keeps track of whether the sound should be played or stopped
var fl_ToPlay_1:Boolean = true;

function fl_ClickToPlayStopSound_1(evt:MouseEvent):void
var mySound:Sound = new background();;

where btnOff turns off the sound and btnOn turns on the sound. My soundtrack is 1:50min long. Is it possible to loop the track within the program with these buttons?



Use, int.MAX_VALUE);