WebBuilder101 - Making the web happen!
Need Web Dev software? Here is the place to
Flash Point


Using the Sound Object for Event Sounds

Event sounds make for ideal usages of Flash's sound object. When creating background music soundtracks, I prefer using the timeline, because it gives me a visual interface for aligning and synchronizing sounds with graphics. With event sounds, on the other hand, this is not as crucial, and action script gives us much greater control. The above example can be created more easily and with greater flexibility than by using the timeline. Here's how:

Create your buttons the same way as in the previous example, with the mouse-over and mouse-hit sounds attached to the corresponding button states. In order for sounds to be used by the sound object, they need to be "linked" and given a name. Select the the first chunk in the library and goto the menu OPTIONS>LINKAGE. Select EXPORT THIS SYMBOL and give it the identifier "loop1". Do the same for any other loops you will be using. Now we need to assign variables and fill them with the linked sounds we just identified.

On frame one, we need to add a new layer called "actions" and add a keyframe where we will insert some action script. Make sure frame one is selected and choose WINDOW>ACTIONS. Change to expert mode by clicking on the arrow at the top right corner of the actions window. Type in the following code:

s1 = new Sound( );
s1.attachSound("loop1");

Do this for each sound you want to control in your movie. Now, you can tell a sound to do any of the actions provided by the sound object. In our case, we are going to tell a sound to stop on a mouse release action. Click on the button instance on frame one, and goto the actions window. Type in the following code (make sure you are in expert mode):

on (release) {
s1.stop( );
gotoAndPlay (5);
}

Do the same for the other button instance on frame 5, only subsituting correct variable name and goto frame number, like so:

on (release) {
s2.stop( );
gotoAndPlay (1);
}

We used the sound object in this example just to render the STOP actions, but you can use it to trigger your buttons mouse over and mouse hit sounds as well.

[Download this FLA] (2.9mb)

Example: Here's a piece by ACI Telecentrics that is a good real-world illustration of transition sounds, as well as using chunks and layers to dramatically reduce file size. The original movie size was 348k. After using a Sound Family to sonify the piece, file size was cut to 148k. Audio file size was reduced by over 75%, and total movie size by over 50%. Here, we show a combination of mouse-over and transition sounds. We talked about transition sounds being used either on a mouse-click or programmatically. You can witness both approaches by either letting the movie play (programmatic) or clicking the "skip movie" button (interactive).

[Watch Movie]


Back Back
.
.

 

More Resources
An Introduction to Flash
Embedding Flash Movies
Learn how to use Graphics Editors
Logo Design - Tips
Creating an Image file
Adding Sparkles to Text
Drop Shadow Effect
Clouds and Lens Flare effect
Creating Transparent GIFs
How to create Icons

Suggested Reading

Beginning Active Server Pages 3.0
JavaScript Bible
Red Hat Linux
Dreamweaver 3.0
HTML Bible



Download WB101 Wallpaper
• Web Builder 101 Wallpaper Get it!.
• Find out how to create your own Wallpaper Teach me!.
Sign up for our Newsletters
• Web Building Sign me Up!.
• Net Alert! Sign me Up!.
Need Help?
• Contact Support Click here.
• E-mail the Webmaster Click Here.
• Search Tips Click Here.

Webbuilder101.com © 1998 - 2003 Copyright and Terms of Use
Send mail to: webmaster@webbuilder101.com

» About » Support

» FAQ » What's New » MyLog

Web Builder 101 Web Builder 101 - Making the Web Happen Web Builder 101 - Making the Web Happen
.