How to mute audio in flash video clip programattically

Tags: flash video audio

I have a site that has as almost all Flash site have music. I want to have a video commercial play and I was wondering if there is a way to make the audio stop while the video is still playing, and then turn back on when I exit the video area.


Press the mute button?

You can use Actionscript's Sound class to change the volume. For example:

s = new Sound(); s.setVolume(0);

This will mute the volume. For more info on this class, see the reference at

By : nikmd23

Imagine videoPlayer is the name of your video player and musicPlayer is the name of your mp3 player. You would have something like.

videoPlayer.addEventListener(MouseEvent.ROLL_OVER, videoPlayerOver);
videoPlayer.addEventListener(MouseEvent.ROLL_Out, videoPlayerOut);

function videoPlayerOver(event:MouseEvent):void{

function videoPlayerOut(event:MouseEvent):void{

this is just a hint. the video player pause() would pause your current soundChannel you're using in the player and store the current position in a variable, and resume() would play the soundChannel from where it left of ( the previously saved position variable )

you might want to pause the player when you press any video controls instead roll over, that was just an idea.

Welcome to stackoverflow and good luck! I think the FAQ mentions something about the difficulty of the questions posted so you might want to have a look.

This video can help you solving your question :)
By: admin