停止所有声音,但一个(Stop all sounds but one)

编程入门 行业动态 更新时间:2024-10-26 12:34:59
停止所有声音,但一个(Stop all sounds but one)

我之前发布了一个关于停止swf中所有声音的问题。 现在,要做到这一点,我正在使用以下代码。

var transform1:SoundTransform=new SoundTransform(); transform1.volume=0; flash.media.SoundMixer.soundTransform=transform1;

这解决了问题(静音所有声音),但现在有一个问题,我想停止所有声音,但一个。 有任何想法吗?

I posted a question earlier about stopping all sounds in a swf. Now, to do that I'm using the following code.

var transform1:SoundTransform=new SoundTransform(); transform1.volume=0; flash.media.SoundMixer.soundTransform=transform1;

Which solves the problem (mutes all sounds) but now there is an issue, I want to stop all sounds but one. Any Ideas?

最满意答案

您必须跟踪当前正在播放的所有SoundChannel 。 你应该创建一个声音管理器,而不是直接调用Sound::play ,并在管理器中进行所有跟踪。 那么你只需要一种方法来做你需要的。

You have to keep track of all SoundChannels that are currently playing back. you should create a sound manager instead of calling Sound::play directly, and do all the tracking within the manager. then you'll just a a method to do what you need to.

更多推荐

本文发布于:2023-08-04 23:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1423176.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:声音   Stop   sounds

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!