# Background Music problem please help!

**URL:** <https://forum.kirupa.com/t/background-music-problem-please-help/316584>\
**Category:** Uncategorized\
**Created:** [November 26, 2010, 10:53pm UTC](https://forum.kirupa.com/t/background-music-problem-please-help/316584 "2010-11-26T22:53:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![intermilan](https://avatars.discourse-cdn.com/v4/letter/i/e274bd/32.png) [@intermilan](https://forum.kirupa.com/u/intermilan)\
**Post date:** [November 26, 2010, 10:53pm UTC](https://forum.kirupa.com/t/background-music-problem-please-help/316584/1 "2010-11-26T22:53:03Z")

</div>

Hi

I just finished a site and I am new to flash

[[COLOR=#003366]http://www.choicesint.com/[/COLOR]](http://www.choicesint.com/)

I have a small problem I want to mute the music when a person clicks on the video page so they dont have to manually click the speaker to shut the sound off to hear the video.  
As well when they leave the video page I want the music to continue playing. The music does not have to start over again, I just want it to mute while on the video page.

I tried using this: SoundMixer.soundTransform = new SoundTransform(0);

But it even mutes the video sound.

And I tried this: SoundMixer.stopAll();

It does kill off the background music, but I dont know how to turn on the music again when you leave the video page.

Can somebody help me please, I have been looking all over the internet and I am really getting confused. I am totally new to this code stuff and I am really getting confused. I need somebody to give me some basic help that I can uderstand. Or be nice enough to give me the simple code so I can make this work.:hurt:

I pasted my script below. The music script and the video script

[SIZE=4] **This is my action script for the music:** [/SIZE]  
// Assign The URL to the mp3 to play  
var req:URLRequest = new URLRequest(“101-jakatta-american\_dream\_(afterlife\_remix).mp3”);  
// Boolean value for button functions, to switch in the conditionals  
var isPlaying:Boolean = true;  
// Create the sound object  
var snd:Sound = new Sound(req);  
// Assign a var name for the sound channel  
var channel:SoundChannel;  
// volume control  
var myTransform = new SoundTransform();  
// Pause position variable  
var pausePosition:Number = 0;  
// Start Playing  
channel = snd.play(pausePosition);  
// Make Play button change cursor to click hand  
playBtn.buttonMode = true;  
// Move the play/pause button movieclip to frame 2(active state)  
playBtn.gotoAndStop(2);  
// Play Button Listener  
playBtn.addEventListener(MouseEvent.CLICK, playPause);  
channel.addEventListener(Event.SOUND\_COMPLETE, onPlaybackComplete);  
// On playback complete function ///////////////////////////////////  
function onPlaybackComplete(event:Event) {  
//trace(“The sound has finished playing.”);  
pausePosition = 0;  
channel = snd.play(pausePosition);  
isPlaying = true;  
channel.addEventListener(Event.SOUND\_COMPLETE, onPlaybackComplete);

}  
// Play/Pause button function ////////////////////////////////////////  
function playPause(event:MouseEvent):void {  
// This conditional makes the magic of our play/pause functionality  
if (isPlaying == false) {  
channel = snd.play(pausePosition); // Start playing  
isPlaying = true; // Set the isPlaying Boolean to true  
playBtn.gotoAndStop(2); // Move the play/pause button movieclip to frame 2  
channel.addEventListener(Event.SOUND\_COMPLETE, onPlaybackComplete);  
} else {  
pausePosition = channel.position;  
channel.stop(); // Stop Playing  
playBtn.gotoAndStop(1); // Move the play/pause button movieclip to frame 2(paused)  
isPlaying = false; // Set the isPlaying Boolean to false  
}  
}

**[SIZE=4]and this if the scipt for the video[/SIZE]**

import fl.video.VideoEvent;  
myPoster.addEventListener(MouseEvent.CLICK, playMovie);  
function showPosterFrame(event:Event):void {  
myPoster.visible = true;  
}  
function hidePosterFrame(event:Event):void {  
myPoster.visible = false;  
}  
function playMovie(event:MouseEvent):void {  
choicesvideo.play();  
}  
choicesvideo.addEventListener(VideoEvent.PLAYING\_S TATE\_ENTERED, hidePosterFrame);  
choicesvideo.addEventListener(VideoEvent.COMPLETE, showPosterFrame);  
choicesvideo.addEventListener(Event.REMOVED\_FROM\_S TAGE, stopPlay);  
function stopPlay(e:Event)  
{  
choicesvideo.stop();  
}
