Join Todd Perkins for an in-depth discussion in this video Controlling volume, part of Flash CS4 Professional Audio Techniques.
In this movie, we'll complete our volume slider by actually making and control…the volume of our sounds.…So the first thing, I wanted you to do is scroll down in Player.as down to…the playSong method.…And right above volSlider.init, we'll call a method that we haven't defined yet,…but we will define later in this movie, called volSlider.updateVolume, and of…course that method is going to update the volume of the sound.…Now the thing is every time we play this song, we want to run Update Volume to…make sure that the volume is the same as it was for the last song.…
That's because every time we play a song, we're creating a new instance of the…sound class, so we need to reset that volume every time.…So, let's save this file, and then head on over to VolumeSlider.…In VolumeSlider scroll down and find the dragVol method.…At the bottom of this method, it's adding event listener to the player.…This is going to be EnterFrame event.…So player.addEventListener, events going to be event.ENTER_FRAME, and we run a…
- Playing and pausing audio in a created player class
- Controlling audio progress and showing it in a text field
- Loading XML playlist data into the final player
- Animating a volume slider and using effects to add depth
- Making Flash applications sharable
- Viewing the finished player and taking it for a spin
Skill Level Intermediate
Q: I am having trouble getting the exercise files to work for this title. For example, when I drag the progress bar of a song to another location on the slider, the movieclip always jumps back to the beginning and the song starts over. What could be causing this error?
A: An update to Flash since the time of recording broke this functionality. The problem appears to happen when Flash compiles the SWF in Flash Player 10. If you change your publish settings to Flash Player 9 instead, you won't see any problems.