Actionscript 3 停止声音而不停止bgm as3
flash专业版。as 3.0.Actionscript 3 停止声音而不停止bgm as3,actionscript-3,audio,Actionscript 3,Audio,flash专业版。as 3.0. 动画 除了具有以下内容的场景结尾外,几乎没有代码: import flash.media.SoundMixer; if(SoundMixer.areSoundsInaccessible() == false) { SoundMixer.stopAll(); } else { trace("There are inaccessible sounds."); } 在动画的末尾,有一个回放按钮的代码 所以我用这个特定的bgm拍摄了这个场景,单个帧层 “声
动画
除了具有以下内容的场景结尾外,几乎没有代码:
import flash.media.SoundMixer;
if(SoundMixer.areSoundsInaccessible() == false)
{
SoundMixer.stopAll();
}
else
{
trace("There are inaccessible sounds.");
}
在动画的末尾,有一个回放按钮的代码
所以
我用这个特定的bgm拍摄了这个场景,
单个帧层<还有另一层的声音
我想要的是在不停止bgm的情况下停止声音
(是的,我知道上面的代码无法工作,因为它会停止所有声音)在我看来,在时间轴中控制声音的更好方法是: 1) 在flash项目库中,右键单击声音并选择“属性…”上下文菜单项-> “声音属性”窗口已打开-> 转到“ActionScript”选项卡-> 打开“导出操作脚本”-> 在“类”文本输入中输入一些类名(例如“MySound1”)-> 单击“确定” 现在,您似乎可以从ActionScript获得 2) 从时间表中删除声音 3) 当您需要开始播放此声音时,请使用代码
var mySound:Sound = new MySound1();
var mySoundChannel:SoundChannel = mySound.play(0);
其中MySound1是您在“声音属性”窗口中设置的类名
当您需要停止声音时,请使用代码
var mySound:Sound = new MySound1();
var mySoundChannel:SoundChannel = mySound.play(0);
mySoundChannel.stop()代码>
使用这种方式,您可以启动/停止任何声音,而无需咕哝其他声音。有人告诉我,尝试将所有内容保存在一个flash文件中。。。是什么阻止你这么做的?将声音嵌入flash库(它们已经位于其中)并使用。我并不是说你需要在运行时加载声音。