| Audio: Sound completion event Description This sample demonstrates how you can use many of the ActionScript methods, properties, and events of the Sound object to control audio in Macromedia Flash. Of special interest is the onSoundComplete event that allows you to initiate scripts when a sound stops playing or looping. In this sample there are six "channels" that all play simultaneously. Each channel has four audio patterns to choose from, though only one pattern will play per channel. The selected pattern will loop continuously until another is selected. When you change patterns for any channel, the current pattern will continue to play until it ends, at which time the new pattern will begin from its starting point. In this way, all the looped patterns will stay in sync regardless of the combination of patterns chosen, or the timing of your selections. Each channel is an instance of the same component. The channel labels and the sounds linked to each channel are dynamically generated based on the instance names of the channels. Key features and ActionScript elements Sound object, components, draggable movie clips, dynamic text, loops (for, for..in) Instructions Click the Play button to begin. Manipulate the sliders and knobs or enter numeric values to adjust the volume and pan of any channel. Valid values for volume are between 0 and 100. Valid values for pan are between -100 and 100. Shift-click any pan knob to initiate an auto-pan. Clicking an auto-panning knob will stop the auto-pan. Click the Mute button (labelled M) on any channel to disable that channel. Click the Solo button (labelled S) on any channel to disable all but that channel. Click any of the four Pattern buttons on any channel to change the pattern for that channel. The Master slider controls the volume of all the channels. The source file for this movie (Sound_completion.fla) can be found on the Flash MX CD in the Goodies/Samples/FLA folder.