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

Chapter 8. Controlling Sound > Creating Dynamic Sound Controls

Creating Dynamic Sound Controls

One of the most effective uses of the Sound object and its methods is to create dynamic controls that allow the user to set the desired volume level or speaker balance. A common strategy is to create a draggable movie clip that acts as a sliding controller. By correlating the position of the draggable movie clip with the volume parameter of the setVolume() method, you can make the volume change dynamically as the viewer moves the movie clip.

For a vertical slider bar that controls volume, you can create two elements: the actual handle or slider and the track or groove that it runs along (Figure 8.26). First, you create a movie clip called groove. To make things easy, make the groove movie clip 100 pixels high with its center point at the bottom of the rectangle. Making the groove 100 pixels high will make it simpler to correlate the position of the slider on the groove with the setVolume() parameter. To create the draggable slider, create a movie clip called slider and assign the startDrag() action with constraints on the motion relative to the groove movie clip.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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