ActionScript 3 音量控制AS3

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 音量控制AS3相关的知识,希望对你有一定的参考价值。

import flash.media.SoundMixer;
import flash.media.SoundTransform;


//All sound channels
SoundMixer.soundTransform = new SoundTransform(.5);



//Without a sound channel:
var sTransform:SoundTransform = new SoundTransform();
sTransform.volume = volumeLevel;
musicSoundChannel.soundTransform = sTransform;


//With a sound channel:
protected static var musicSoundChannel:SoundChannel;
...
var urlRequest:URLRequest = new URLRequest(url);
if (musicSoundChannel != null){
	musicSoundChannel.stop();
}
musicSound = new Sound();
musicSound.load(urlRequest);
if (musicSound != null){
	musicSoundChannel = musicSound.play();
}

var sTransform:SoundTransform = new SoundTransform();
sTransform.volume = volumeLevel; //Volume level is a Number between 0 and 1
musicSoundChannel.soundTransform = sTransform;

以上是关于ActionScript 3 音量控制AS3的主要内容,如果未能解决你的问题,请参考以下文章