Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 播放声音时动画暂停_Actionscript 3_Flash - Fatal编程技术网

Actionscript 3 播放声音时动画暂停

Actionscript 3 播放声音时动画暂停,actionscript-3,flash,Actionscript 3,Flash,当我播放声音时,通常是第一次,但有时也会在随后的时间播放,我的应用程序当前播放的动画会暂停 我将所有声音对象存储在一个名为Jukebox的类中的静态变量中。在我的代码中的任何地方,我需要播放一个声音,我称之为自动存储塔的静态方法playSfx() 以下是相关代码: public static function playSfx( snd:Sound, vol:Number = 1 ):void { _channelSfx = snd.play(); _transform = _ch

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

我将所有声音对象存储在一个名为Jukebox的类中的静态变量中。在我的代码中的任何地方,我需要播放一个声音,我称之为自动存储塔的静态方法playSfx()

以下是相关代码:

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

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

这里没有足够的内容来充分回答您的问题(您提到的动画对象在哪里?)。但是,请注意,您需要为要在其上播放的任何新声音文件重新创建声音对象。这是使用声音时常见的陷阱。舞台上的任何动画都会暂停。是的,我已经在做了。第一次调用时感觉声音正在加载,因此出现失速?但我有一个预装机。