Skip to main content
May 25, 2010
Question

Stopping sound...

  • May 25, 2010
  • 1 reply
  • 522 views

Hey all!

Ok, so I found a couple different threads on here about stopping and starting sound but my question is a bit unique from them all.

I'm working with a Flash website template that has a soundtrack playing upon the site loading. The soundtrack is located on the main timeline, frame 5, and loops continuously.

Now, I am creating a video clip page for users to click and load videos to watch. As you probably guessed, once the video loads, there are now 2 soundtracks playing. I tried switching it up so that the video doesn't load automatically upon entering the frame and then noting to the user to stop the site sound by pressing the button up top (sound control) and then load the video, but because of the coding, the sound is completely disabled and the video sound is muted as well.

The problem is that the video page is embedded into a movie clip within the main timeline.

Here is the code for the sound controller on the main timeline:

---------------------------------------

onClipEvent(load)
{
  _root.soundstatus="on";
  _root.mySound = new Sound(_level0);
  _root.mySound2 = new Sound(_level1);
  _root.mySound3 = new Sound(_level2);
  _root.mySound4 = new Sound(_level3);
  _root.mySound5 = new Sound(_level4);
  maxvolume=100;
  minvolume=0;
}

onClipEvent(enterFrame)
{
  if(_root.soundstatus=="on") {step=5}
  if(_root.soundstatus=="off") {step=-5}
 
  maxvolume+=step;
 
  if (maxvolume>100) {maxvolume=100;}
  if (maxvolume<0) {maxvolume=0;} 

  _root.mySound.setVolume(maxvolume);
  _root.mySound2.setVolume(maxvolume);
  _root.mySound3.setVolume(maxvolume);
  _root.mySound4.setVolume(maxvolume);
  _root.mySound5.setVolume(maxvolume);
}

---------------------------------------

My question is, can that controller be made to just kill all sound that is currently playing and not all sound at all times? So the user gets to the page, reads the note, stops the site music, then clicks to load a video and the video sound is all you hear. When they are done, they can just restart the site music if they want to.

Possible?

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 25, 2010

no.

that's poor coding and has no flexibility to do what you want.

the best solition would be start over and encode that correctly using a loop that you can start and stop when needed.

May 25, 2010

Dang, ok thanks!

kglad
Community Expert
Community Expert
May 25, 2010

you're welcome.