S > Sound.setPan

Sound.setPan

Syntax

mySound.setPan(pan);

Arguments

pan An integer specifying the left-right balance for a sound. The range of valid values is -100 to 100, where -100 uses only the the left channel, 100 uses only the right channel, and 0 balances the sound evenly between the two channels.

Description

Method; determines how the sound is played in the left and right channels (speakers). For mono sounds, pan affects which speaker (left or right) the sound plays through.

This method is cumulative with the setVolume and setTransform methods, and calling this method deletes and updates previous setPan and setTransform settings.

Player

Flash 5 or later.

Example

The following example uses setVolume and setPan to control a sound object with the specified target "u2":

onClipEvent(mouseDown) {
// create a sound object and
s = new Sound(this);
// attach a sound in the library
s.attachSound("u2");
//set volume at 50%
s.setVolume(50);
//turn off the sound in the right channel
s.setPan(-100);
//start 30 seconds into the sound and play it 5 times
s.start(30, 5);

See also

Sound.setTransform
Sound.setVolume