During playback, it is possible to manipulate the volume and pan
of individual channels, as well as the global mixer containing all
sounds. Doing so requires the
The process involves storing a reference to the transform object of the channel or mixer, setting the volume and/or pan setting, and then repopulating the original transform object with the newly altered reference transform. For example, this script will set the volume of the single channel in our ongoing discussion to 50 percent.
var trans:SoundTransform = new SoundTransform(); trans.volume = 0.5; channel.soundTransform = trans;
Most ActionScript 3.0 settings that use percentage values use a unit range of 0 to 1. For example, volume is expressed as a range of 0 (muted) to 1 (full volume) with any interim value expressed as a percentage of full volume. To determine a value that describes a pan setting between left and right stereo channels, a percentage left and percentage right is required. Therefore, the units are expressed as a range of −1 (full left) through 0 (centered) to 1 (full right). Negative interim values reflect some degree of pan left, and positive interim values reflect some degree of pan right. The following script sets the channel in the prior example to a pan setting of full left:
var trans:SoundTransform = new SoundTransform(); trans.pan = −1; channel.soundTransform = trans;
To transform all playing sounds at once, simply substitute the specified channel ...