Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Scene Sound Toggling 1

Status
Not open for further replies.

SlimJim

Programmer
Aug 7, 2000
16
0
0
US
Okay, check this out and hopefully someone out there can help me!

Using ActionScripting, I can get my sound to turn on and and off just fine through the movie clip, "mute". In the movie clip "mute" I use one button representing sound on and one for sound off that each tell target "/mute" to play. "Mute" movie clip is only two frames long, and each frame has a "stop" action in it. The first frame has sound on it and the other has "stop all sounds."

Like I said, this works fine for toggling the music, BUT:

...when the movie goes to the next scene, the button is defaulted back to the "play" setting and resumes play of music even if the user has requested muted music. I've tried setting the variable "sound" to 1 if music is on and 2 if music is off and then tried to get the next scene to recognize that and tell target "/movie" accordingly. For some reason this does not work.

Does anyone have any suggestions? Is my sound toggling too generic for this to work? Is it even possible to do what I'm trying to do?

Thanx in advance for any and all help with my little problem!

Jimbo
 
This is kind of tricky but you can put your music movie clip in a different movie. (creating a new .swf file)
Once you have the music.swf file, you can now go back to your original movie and instead of doing your toggling like you did before, you use Load/Unload Movie ("music.swf",1), so you load the music at _level1.

This way, your music will play continuously regardless of the scene where you are. Plus, you control the on and off with the Load/Unload.

I hope that helps.
 
Well...here's the dilemma...

I can make the music turn on and off...it's just the scene changing that I can't get to flow.

If I do use your method, I believe I'll still have the same problem:

Let's say the user comes to the site and hits the mute button. The command to unload the movie will turn the sound off, right? But, as soon as the movie goes to the next scene, a new instance of the sound on/off button will appear but will not know the current status of weather or not the user wanted sound. It will default to however it's set initially, right?

I mean, correct me if I'm wrong, but isn't that the same thing I've already got? I'm just using a movie clip instead of a whole new .swf file.

Thank you for you help...I do appreciate it! Let me know if you can think of a way out of this little ditty...

SlimJim
 
You don't need to "remember" the previous state because the music is loaded as an external file at a different _level and as long as you create the music.swf file correctly, (so it runs continuously) it will keep playing. Remember to load your music at _level1 so it runs separately.

You will need to have on/off buttons on each scene.

It works.

Fernando
 
OK Slim, maybe I didn't explain myself so good.
The music file will run and run until the user stops it. If the user mutes, you unload the movie. If the user goes to the next scene, your movie is still not loaded.

If the user doesn't mute the sound and goes to the next scene, your sound won't stop because it is a separate file at a different level. The music will just keep playing, so you don't have to worry about whether the sound is loaded or not.

The way you were doing it before didn't give you this flexibility because the sound was loaded at level0 in the scene, so when you change scenes, the sound stops and you need to call it again.

I hope that helps, but if you have any questions let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top