ConfusedDreamweaverUser ConfusedDreamweaverUser - 1 year ago 170
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?


Answer Source

Use, int.MAX_VALUE);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download