Dowload PDF in Full Site Email the Author

Adding Sound to the Arrow
To add the sound, first we need to prepare the sound clip in the Library to be addressed by ActionScript. The process is similar in concept to giving an Instance an Instance Name, but is not precisely the same thing. To give a sound clip a unique name that can be use by ActionScript, {Right-Click} the sound clip in the Library and select Linkage.


{Right-Click} the Sound Symbol and select Linkage.

The Symbol Linkage Properties dialog-box appears.

{Click} Export this symbol and input a name for the Symbol in the Identifier field. This is the name that we will use in ActionScript to use activate this sound. In this case, use the name drop.

Next, select OK. Now we’re ready to add the script to trigger the sound into the button. Select the Instance of button.empty over clip.arrow. Thus far we have:

on (press) {
xc._rotation+=180;
}

Below the statement xc._rotation+=180 we’ll add the following three (3) statements:

clickSound = new Sound(this);
clickSound.attachSound("drop")
clickSound.start();

The complete code set for the button this far should appear as follows:

on (press) {
xc._rotation+=180;
clickSound = new Sound(this);
clickSound.attachSound("drop")
clickSound.start();
}

Let’s take a look at the three (3) statements which activate the sound.

clickSound = new Sound(this);

Our first step, instantiate the Sound Object (or Class if you prefer). We’re going to call our Instance of the Sound Object clickSound. The argument this tells Flash that we are making an Instance of the Sound Object on the current Timeline. If we were to leave this argument blank, the Sound Object clickSound would have control of any sounds we attach to it movie wide.

clickSound.attachSound("drop")

We use the attachSound method to specify which sound we wish to control in our object. We gave the Sound Symbol Switch Small Plastic an Identifier called drop. Hence we refer to drop in the argument of the attachSound method.

clickSound.start();

Finally, we use the start method to tell the sound in our clickSound Sound Instance to start playing. Arguments include how many seconds into the sound clip itself the sound begins and how many times we want the sound to loop. We just want the sound to play once, completely through, each time the user {Clicks} the arrow button so we leave the arguments blank.
If you’re following along, test the movie or run m0005.swf. Now, when you {Click} the arrow, you should hear the sound occur as well as have the arrow flip. At this point you may also want to load 0005.fla if you’re having any problems with your own file.


Introduction Adding Sound to the Arrow
How the Menu will Function Building the Menu Item Clips
A Look at the Menu Generic External Scripts
Planning and Mapping Navigation Building the Submenu Clips
Building the Assets Menu Assembly: Putting the Clips Together
Sound Building and Scripting the Fly-outs
Draggable Menu Menus within Menus
Expand/Collapse Arrow