• 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 so that the user can set the desired volume level or speaker balance. The basic strategy is to create a draggable movie clip that acts as a sliding controller. By correlating the position of the draggable movie clip to the volume parameter in 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 there are two elements: the actual handle or slider, and the track or groove that it runs along (Figure 8.29). You would first 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 to the setVolume parameter. To create the draggable slider, place an invisible button inside the slider movie clip that assigns the startDrag action and constrains 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