Varying the volume of a Flash sound file




c

x

 
 

Varying the volume of a Flash sound file

Open a new Flash document.

Import an mp3 file to the library - name it 'Mariachi' for this exercise.

Insert, New Symbol, choose movieclip, name it soundclip. You'll now be inside soundclip, editing it, with one blank keyframe.

Drag the mp3 file from the library onto the stage. You'll see a line in frame 1 of your movieclip, which is the start of the sound.Open the Properties panel and make sure Sync is set to Stream.Click the Edit button to open the Edit sound window.Set the view to frames and scroll all the way to the right to see how many frames the sound lasts at the current frame rate.

Extend the timeline of your movieclip out to that frame.

Click on the symbol for your soundclip and type in the following Action Script:

var Mariachi:Sound = new Sound(Mariachi);
Mariachi.setVolume(10);

The (10) means it will play at 10% of the volume the original mp3 played at. If you typed in (100) it would play at the recorded volume and (1000) would make it play at 10x the original volume!

Now test the movie and observe the volume change.

 

 

 

 

2012 - A Cybercomputing Page - All rights reserved - (2011 - 12)