Hands-On: Flash MX 2004 Working with Sound File
Exercise 22: Music On/Off Buttons inside a Movie Clip
- Create and then save a new document as musicOnOffButton.fla .
- Set the movies Frames Per Second rate to 20fps .
- Import a WAV sound file to the Library named french.wav .
- Create a new Movie Clip [ Ctrl ] + [ F8 ] and name it music .
- Drag the sound file from the Library onto the stage of the music Movie Clip.
- Specify the sound Effect: setting to Fade-In when it starts.
- Set the Sync: to Start and then set it to Loop .
- Select frame 20 and then press [ F6 ] to add a keyframe.
- In the Properties Inspector find Sound: and then select the french.wav file you added to the Stage from the drop-down listing.
- From the Sync: choose Stop .
- Rename the first layer as Audio .
- Lock this layer.
- Create a new layer and rename it to Actions .
- In the first frame of the Actions layer press [ F9 ] to open the Actions panel.
- Add a Stop Action by typing stop(); and then close the Actions panel.
- Lock the Action Layer.
- Add a new layer and then rename it to Labels .
- Select the first keyframe of this layer and then in the Properties Inspector rename the Frame Label music on but don't add any quotations, and then hit the [ Enter ] key.
- Select frame 20 of this layer and then press [ F6 ] to add a keyframe.
- In the Properties Inspector name this Frame Label music off don't add any quotations, and then hit the [ Enter ] key.
- Add a few blank frames to each row in the timeline [ F5 ] so you can see the frame labels on the timeline.
- Lock the labels layer.
- Insert a new layer and then name it buttons .
- Return to frame one of the timeline.
- Open the Common Library .
- Open the Playback Folder.
- Select the Gel Stop Button.
- Drag it onto the stage and align to the middle of the Stage.
- Select frame 20 of the buttons layer and then press [ F7 ] to add a blank keyframe.
- Select the Gel Right button from the Common Library.
- Drag it onto the stage and align to the middle of the Stage.
- Return to frame one of the buttons layer.
- Click once on the Stop Button in frame one and then press [ F9 ] to reopen the Actions panel.
- Choose Global Functions > Movie Clip Control > ON > choose Release .
- Click after the opening curly brace { and then hit [ Enter ].
- Choose Global Functions > Timeline Control > gotoAndStop() and type with double-quotes "music off" . This must be spelled exactly the same as the frame label.
- Move to Frame 20 , click once on the Play Button and then press [ F9 ] to open the Actions panel.
- Choose Global Functions > Movie Clip Control > ON > choose Release .
- Click after the opening curly brace { and then hit [ Enter ].
- Choose Global Functions > Timeline Control > gotoAndStop() and type with double-quotes "music on" . This must be spelled exactly the same as the frame label.
- You are finally done working on the Movie Clip called music, now return to Scene 1 and drag a copy of the music Movie Clip onto the Stage anywhere you'd like it to be.
- Click on the sound file french.wav in the Library and then at the bottom of the Library panel, click on the ( i ) icon to open the Properties for the french.wav sound file.
- Change the compression setting to MP3.
- Change the bit rate to 32Bit.
- Take off the checkmark for Preprocessing: Convert stereo to mono, so you can hear the music in Stereo .
- Test your movie by hitting [ Ctrl ] + [ Enter ].
- The music fades in as soon as the page loads, but there is a stop button to halt the sound. Click the OFF button and the button turns into an ON button to replay the music from the start.
You can download this sound file for the exercise.
http://profal2.com/cis127/pdf/assets/flash/french.wav
|