
Sound.setPan() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
786
|
ActionScript Language Reference
// Usage:
// Create a new Sound object.
var music = new Sound();
// Attach a sound from the Library and play it
music.attachSound("song");
music.start();
// Invoke the startFadeIn() method with a 2 second fade (2000 milliseconds)
music.startFadeIn(2000);
See Also
Sound.attachSound(), Sound.duration, Sound.loadSound()
Sound.setPan() Method
set the balance of a sound’s left and right channels
Flash 5
soundObject.setPan(pan)
Arguments
pan A number between –100 (left) and 100 (right), indicating the distribution
between the left and right speakers for sounds controlled by
soundObject.If
the
pan supplied is greater than 100, the actual value assigned is 200 – pan.If
the
pan supplied is less than –100, the actual value assigned is –200 – pan.
Description
The setPan() method dictates the balance of the right and left channels of the sounds
controlled by
soundObject. By adjusting the pan over time, we can cause a sound to move
from one speaker to the other (known as panning).
To play the sounds controlled by
soundObject in the left speaker only, use a pan of –100. To
play the sounds controlled by
soundObject in the right speaker only, use a pan of 100. To
balance the two channels evenly, use a
pan of 0.
Note that setPan() affects all the sounds controlled ...