在AS3中循环播放声音

时间:2016-08-26 03:42:20

标签: actionscript-3 flash actionscript flash-cs6 flash-cc

在我的Flash程序正在使用时尝试循环播放背景音轨。

到目前为止,我的代码是:

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

function fl_stopsound(event:MouseEvent):void
{
    SoundMixer.stopAll();
}

//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(); 
        mySound.play();
    }

其中btnOff关闭声音,btnOn打开声音。我的配乐是1:50分钟。是否可以使用这些按钮在程序中循环轨道?

干杯

1 个答案:

答案 0 :(得分:0)

使用public class RavenConfig : IWantToRunBeforeConfigurationIsFinalized { public void Run() { Configure.Instance.RavenPersistence("AllHostsRavenDB"); Configure.Instance.RavenSagaPersister(); Configure.Instance.RavenSubscriptionStorage(); Configure.Instance.UseRavenTimeoutPersister(); } }