When you want more precise control of how a sound is playing through the left and right speakers, the Sound class in Flash® 8.0 includes the method setTransform(). This method allows you to set percentages that determine how much of the right or left channel plays through the right and left speakers. Using this method, you can make your sound switch speakers from left to right dynamically or switch from stereo to mono. To use setTransform() with the Sound class, you create a generic object and add properties to it that hold the information specifying the distribution of left and right sounds. The properties of the sound transformation object are ll, lr, rr, and rl (Figure 1).
Figure 1: The properties of the object passed to the setTransform() method determine distribution of sounds between the left and right speakers. The first letter refers to the output speaker; the second letter refers to the input sound.
To follow along with this article, you will need the following software:
Basic knowledge of Flash 8
H. Paul Robertson is an ActionScript developer/writer for the Platform Developer Documentation team at Adobe Systems. Previously he worked as a web applications developer and co-authored Macromedia Flash 8 Advanced: Visual QuickPro Guide (Peachpit Press, 2005) with Russell Chun. Paul is a Certified Flash Developer and holds a Masters degree in Instructional Systems Technology from Indiana University. When he's not programming web applications, writing about web applications, teaching about web applications, or updating his blog, Paul spends his time taking pictures, collecting kitchen gadgets, and trying to achieve his three children's level of mastery of Legos, Star Wars trivia, and other equally important subjects.
Excerpted from “Macromedia Flash 8 Advanced for Windows and Macintosh: Visual QuickPro Guide” by Russell Chun and H. Paul Robertson © 2006. Used with the permission of Peachpit. To purchase this book, please visit www.peachpit.com.