|
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]
|