MMC3711-INTERACTIVE MULTIMEDIA

 

tutorial_S4

Page history last edited by Joey Bargsten 1 yr ago

HOME  â€¢  SYLLABUS/SCHEDULE  •  ASSIGNMENTS  â€¢   COURSE RESOURCES   •   YOUR PAGES   •   YOUR FEEDBACK

 

 

Adding Sound In Flash

 

Sound is unnecessarily tricky in Flash. Sure, you can put sounds on a layer in a movie clip or in a state on a button, but this is not a great approach - - you can't really control sound too effectively- - the sound will not stop when you want it to, or it might loop, or you might hear multiple copies of the sound as you hit the button repeatedly. Pretty clunky.

 

The best way to deal with sound (and here we're talking non-synch sound, background sound or music or narration that doesn't necessarily synchronize to an animation or video) is to convert the sound to an object, and use actionscript to control an instance of that sound object.

 

First, import your sound to the Library. Select the Library options, and select Linkage. Give the sound a symbol name (that's the "hammer1" in the example below), and have it export to frame 1.

 

The name of your sound is your sound object. You make it play by initializing an instance of a sound, attaching the sound object to it, and then playing or stopping it. On the timeline-to-interface project, you'd put this script on each new keyframe (corresponding to a page or section of content):

 

s = new Sound();

s.attachSound("hammer1"); 

s.start(0, 12);  

 

Here's the form of the script that would then stop the sound:

 

on (release){

s.stop();

gotoAndStop (5);

}

 

Some things to be aware of when using this approach:

 

1) This is very loop-friendly: in the 'start' script, the parameter list two numbers ('0, 12' in the example). The first number is the offset in milliseconds of the sound - - where in the soundfile to begin the sound. The second is the number of iterations or repetitions of the soundfile. 

 

2) This method might not be the best way of coordinating sound and a visual animation in a movie clip- - the shorter the sound clip the better.

Comments (0)

You don't have permission to comment on this page.