Connecting Tech Pros Worldwide Help | Site Map

Background music starts another one when movie clip replays.

Newbie
 
Join Date: Sep 2008
Posts: 1
#1: Sep 19 '08
I have just tried to attach a background sound with on/off button to my movie clip at frame 1 of the main Timeline.

Flash Movie: the movie will keep on replaying until a viewer clicks a button.
(frame 1 to 7)


Problem: the background sound plays again on top of the ancient one. And as the movie starts again, one more piece will be played, and so on.


I've tried to use different approach with action script but no luck, Please help.
Familiar Sight
 
Join Date: Sep 2007
Posts: 207
#2: Sep 20 '08

re: Background music starts another one when movie clip replays.


Hi
You didn't say what version of AS you are using.

If it's AS3 then try to stop all playing sounds before openning a new channel by using this code:

Expand|Select|Wrap|Line Numbers
  1. SoundMixer.stopAll();
  2.  
Add this line before any sound command to stop all playing sounds.

I think the problem with your script is that when it goes to the begining, the other sounds are still running. That means the user needs to stop the sound and then play another one. But if you add this line the script will automaticaly stop all sound before playing the new one
Newbie
 
Join Date: Aug 2008
Posts: 11
#3: Sep 25 '08

re: Background music starts another one when movie clip replays.


just a suggestion: you may want to consider embedding the .swf that repeats inside the .swf that plays the music, or embedding both files inside a third. This should give you more control over the sound by keeping audio playback independent from video looping.
have fun!
Reply