停止的声音没有停止BGM AS3 [英] stopping sounds without stopping bgm as3

查看:129
本文介绍了停止的声音没有停止BGM AS3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

闪光灯亲。为3.0。照片 动画。
几乎没有C $ CS $除了有场景的目的:

flash pro. as 3.0.
animation .
almost no codes except ends of scenes having :

import flash.media.SoundMixer;
if(SoundMixer.areSoundsInaccessible() == false)
{
    SoundMixer.stopAll();
}
else
{
  trace("There are inaccessible sounds.");
}

和在动画,code表示重播按钮的末端。

and at the end of animation, a code for replay button.

所以...
我得到了这一幕,这个特定的背景音乐,
单独的帧层。
和在另一层的声音。
我想是停止声音没有停止BGM。
(是的,我知道上面code是行不通的,因为它会停止所有的声音)

so...
i got this scene, with this specific bgm ,
individual frame layer.
and the sounds at another layer.
what i want is to stop the sound without stopping the bgm .
(yes, i know the above code wouldn't work as it stops all sounds)

推荐答案

在我看来,更好的方法来控制声音的时间表是:

In my opinion better way for controlling sounds in timeline is:

1)在闪存项目库使右键点击你的声音,并选择属性...上下文菜单项 - >

1) in flash project library make right click on your sound and select "Properties..." context menu item ->

声音属性窗口中打开 - >

"Sound Properties" window opened ->

转到动作选项卡 - >

goto "ActionScript" tab ->

在为ActionScript导出开关 - >

switch on "Export for ActionScript" ->

输入一些类名称为类文本输入(例如,MySound1) - >

enter some class name into "Class" text input (for example "MySound1") ->

点击确定

现在你从ActionScript声音缴费

Now you sound avaiable from ActionScript

2)删除时间表声音

3)当你需要开始播放这个声音使用code

3) when you need start play this sound use code

var mySound:Sound = new MySound1();
var mySoundChannel:SoundChannel = mySound.play(0);

在这里MySound1是你的声音属性窗口中设置类名。

where MySound1 is class name which you set in Sound Properties window.

当你需要停止你的声音使用code

when you need stop your sound use code

mySoundChannel.stop();

使用这种方式,您将能够启动/停止任何你的声音,而不mutting其他声音。

Using this way you will able to start/stop any your sounds without mutting other sounds.

这篇关于停止的声音没有停止BGM AS3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆