Sound

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

c Introduction

While working in Flash with sound/music files you will find it really necessary to use a sound

on/off button as an option. We have endeavored to make the action scripting used in this tutorial

as basic & minimal as possible. Happy Learning!

Please take a look at the demo above. This demo is a simple play/stop button for you to control

the sound files in your Flash project. Usually you will need to have the music playing and have a

stop button displayed first. Since it is easier to understand how a play and then stop button

works we have used this example first. Once this is done we will also teach you how to start with

the sound playing and the stop button displayed.

reparing buttons, importing your sound file and


setting the timeline

Ôc ëreatec c   that are sort of similar and

represent c c c  . For example you can

use play/stop or speaker with sound waves/speaker

with a cross buttons.

Ôc  
c 
c c c  c 
c   Press

(ëtrl+R) to get the Import screen, now browse to

locate your sound file.

Ôc Open your Library panel (ëtrl+L), locate and right

click on your sound file. From the list select

× cthe linkage properties form will pop-up. In

the identifier text box enter  and tick the "Export


for Actionscript" and "Export in first frame" options

under Linkage.

What this Does You are giving the sound file in the

library an  
without it actually being used in

the movie timeline. This enables it to be called and

used by ActionScript code.

Ôc In your movie timeline, create 3 consecutive key

frames. Place your Play button in the second frame

and label it as   and your Stop button in the third

frame and label it as   (The frame label is specified

in the properties window). They should both be in the

same position for them to look like a switch (see

demo).

Daking your sound on/off buttons functional using


ActionScript
[asic Logic We are utilizing the inbuilt Sound ëlass in Flash to dynamically load the sound file

and the on/off buttons to play and stop it.

Ôc ëlick the first key frame and copy-paste the following

actionscript into the actions panel.

c c c c

  c

  
c

You might also like