iPhone Forum

General Discussion - How to Set Volume in Flash

kasselbiddy - Mon Sep 03, 2012 6:47 pm
Post subject: How to Set Volume in Flash
Here is how you go about setting the volume of sound in Flash. There are two ways of setting volume, either on a per-channel basis or globally across all channels. Besides, here is a tutorial about how to convert SWF to MOV on Mac with a Mac SWF to MOV converter.
Image

Before we dive in it is worth taking a quick look at the four main classes used when manipulating sound in Actionscript 3.0.

* Sound
An object representing an individual sound. This may be a sound effect or music loop.
* SoundChannel
A channel which plays a single Sound object.
* SoundTransform
Class used to manipulate the volume and/or panning of a sound.
* SoundMixer
A class containing static methods for controlling the global output of sound in a SWF.

Setting the volume of an individual sound
We can set the volume of a single sound channel at two distinct occasions, when the SoundChannel is instantiated as a result of calling the play method of a Sound instance, or we can alter the volume of an already existing SoundChannel.

Volume is set via an instance of the SoundTransform class. A SoundTransform instance is simply applied to the soundTransform property of a SoundChannel. Here we apply a SoundTransform instance with a volume of 0.5 to an existing SoundChannel called myMusicSoundChannel.

myMusicSoundChannel.soundTransform = new SoundTransform(0.5);

Note the volume value is specified as a number between 0 (silent) and 1 (full volume).

Next we set the volume of a SoundChannel during it’s initialization. The Sound instance, mySound, is set to play a single time with a volume of 0.5.

var mySoundChannel:SoundChannel = mySound.play( 0, 0, new SoundTransform(0.5) );
Setting volume globally

Setting the global volume of sound in your SWF is very similar to setting the volume of a single sound. The main difference is that we aren’t manipulating a single SoundChannel instance, rather we use the SoundMixer class.

SoundMixer.soundTransform = new SoundTransform(0.5);
ivy00135 - Wed Nov 07, 2012 5:30 pm
Post subject:
牛小弟牛排
櫥窗滷味
天才老媽雙蛋蚵仔煎
爆米花
法式可樂餅
鹽水意麵
高雄酒店經紀
豬心冬粉
林家水餃
阿賢料理
光華木瓜牛奶大王
輝哥鱔魚意麵
酒店經濟
亞培湯包蒸餃
阿六鱔魚麵
孬味香菇肉羹
萬里羊肉店
屏東豬腳
劉易記牛肉刀削麵
酒店小姐
高雄酒店經紀
星座運勢2012
星座配對2012
牡羊座2012年星座運勢
金牛座2012年星座運勢
雙子座2012年星座運勢
巨蟹座2012年星座運勢
獅子座2012年星座運勢
處女座2012年星座運勢
天秤座2012年星座運勢
天蠍座2012年星座運勢
射手座2012年星座運勢
魔羯座2012年星座運勢
水瓶座2012年星座運勢
雙魚座2012年星座運勢
All times are GMT - 8 Hours
Powered by phpBB2 Plus and Kostenloses Forum based on phpBB