Académique Documents
Professionnel Documents
Culture Documents
FLASH TUTORIAL 8
(Working with sound)
1. We can add *.wavs, *.mp3s and any other audio format you want to a flash
animation.
2. Before we can use sounds, we have to import it into our project library. From the
file menu, click on IMPORT then IMPORT TO LIBRARY. Find the file or
files you want imported and click ok.
3. The library view is not viewable by default so you will probably have to hit ctrl+L
or select Windows>Library. When it opens, it will appear in the bottom right
hand corner of your workspace. If you click on the filename to highlight it, it will
show you the cool wavelength above it.
4. To include the audio, you have to select a single frame or keyframe in one of your
layers.
5. Now highlight the audio file name in your library, and drag the file from the
library to stage. You would now see that wave appeared in the frames in timeline.
6. Highlight the wave in any part of the frames, your properties tab (by default is
located on the bottom of your workspace) will display the options. You may want
to experiment a little bit to see what everything does. In short, under Sync: there
are four choices. EVENT will play the entire audio clip in its entirety regardless
of how long the animation or intro is. If you select STREAM, the audio will
begin at the beginning of the clip and end the minute the last frame of your
animation is over. Selecting STOP or START will make it ignore the action script
“start” or “end” commands.
7. From this menu, you can select how many times you want the sound to repeat or
you can have it continually loop until the end of time.
* Run " T8-soundOnOff.swf" to have a preview of what can be accomplished from this tutorial.
6. With the 1st frame in the sound layer selected, drag the “T8-Hype.mp3” sound out
of the Library and drop it anywhere on the Stage.
1. Return to main stage, point to the sound layer, then view the Properties Inspector,
make sure “Sync” is set to Start, choose Repeat, and type 5.
2. Create a new layer and name this layer as “buttons”. Drag two buttons named
“soundOn” and “soundOff” from the library and put anywhere on the stage.
on (release) {
gotoAndPlay(1);
}
4. Select sound off button, press F9 and type the following script:
on (release) {
stopAllSounds();
5. In the timeline, add a new layer and name it as actions. Make sure the actions
layer is above all layers.
6. Select all the layers at once and press F5 to add a frame to each layer in the
Timeline.
7. In the timeline, select frame 2 of the actions layer and press F7 to add a blank
keyframe. Press F9 and type the following scripts:
Stop();
You may also set sound button to play external sound file, do as follows:
1. You can use “audacity” open source audio software to edit external sound file.
4. In the library, point the “T8-alert.wav”, then right click, choose “Linkage”
6. Type “beep” in the “Identifier” text field and then click OK.
8. Create a button, point to the button, press F9 and type the following script:
On(press){
mySound=new Sound();
mySound.attachSound(“beep”);
mySound.setVolume(100);
mySound.start();
}
THE END