• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Controlling Sound > Modifying Sounds

Modifying Sounds

When you use the Sound object, Flash gives you full control of its volume and its output through either the left or right speaker, known as pan control. With this level of sound control, you can let your users set the volume to their own preferences, and you can create more-realistic environments. In a car game, for example, you can vary the volume of cars as they approach or pass you. Playing with the pan controls, you can embellish the classic Pong game by making the sounds of the ball hitting the paddles and the walls play from the appropriate sides.

The two methods for modifying sounds are setVolume() and setPan(). The method setVolume() takes a number between 0 and 100 as its parameter, representing the percentage of full volume. So 100 represents the maximum volume, and 0 is silence. The method setPan() takes a number between –100 and 100. The setting –100 plays the sound completely through the left speaker, 100 plays the sound completely through the right speaker, and 0 plays the sound through both speakers equally.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint