1

当我播放声音时,通常是第一次,但有时在随后的时间里,我的应用程序的当前播放动画会停止。

我将所有 Sound 对象存储在名为 Jukebox 的类中的静态变量中。在我的代码中的任何地方,我都需要播放声音,我调用了名为 playSfx() 的 Jukebox 的静态方法。

以下是相关代码:

public static function
playSfx( snd:Sound, vol:Number = 1 ):void
{
    _channelSfx = snd.play();
    _transform = _channelSfx.soundTransform;
    _transform.volume = vol;
    _channelSfx.soundTransform = _transform;
}

任何帮助将不胜感激。干杯!

4

0 回答 0