Switching buttons on click

my site’s audio can be turned on and off using one button.

when music is playing, the button should be “audio off”.
when clicked, the audio is off and the button switch to another button “audio on”, if clicked again, the music is back on, and the button is back to “audio off”, and so on …

i already have this universal button and have it working great.

i just want to do the switching. anyone can help ??

(like onClick or onRelease switch to button2)

Here’s one I did a very long time ago.

thanks buddy …

Anytime :bandit:

i think you are using the “loadmovie” and “unloadmovie” things, like everybody else. i am new to Flash and i am learning.

can you tell me something quick about it and how i should do it?

thx

theres no unload movie in that fla, what Kel - 420 has done, is create two frame labels, on and off, which are indicated on the first layer. then on first button there is code to load a external swf which would turn off the music.


on (release) {
    loadMovieNum("nosound.swf", 10);
    gotoAndPlay("off");
}

so this button would load a swf called nosound in level 10 of flash, and then go to the frame label called off where there is a graphic to represent that the sound is off

edit:: you could also use


on (release) {
    unloadMovieNum(10);
    gotoAndPlay("off");
}


this is if you want to unload the swf in level 10 , which would be like turning off the sound in this situation.

then on the second frame

there is the code to turn off all sounds


stop();
stopAllSounds();

and on the button


on (release) {
    loadMovieNum("music01.swf", 10);
    gotoAndPlay("on");
}

so when this button is pressed it will load a external swf called music01.swf in level 10 which will replace the other sound that was already in level 10 and then go to the frame label on which had the graphic to represent the sound is on.

hope this helps! :smirk:

it cant seem to work, and i dont know why.
i am trying to do the same as the attachment on a MC. my webpage is all done with Flash.
i will try to make it simpler: i have a 800x600 document that has buttons and mousetrail and stuff like that … thats where i am trying to add this audio button.

any advices ?

Well Soulty did a good job explaining it as I forgot to.

The nosound.swf is just an empty swf.

How exactly is it NOT working? Do you have a link for us to look at?

i dont have my site published yet, and the SWF file is big to attach. i will try to explain.

my document is 800x600, on this i have a background image.
on this image i have added buttons, like: home, portfolio, pictures, contact.
these buttons have mouseovers effects.
in a corner i added a button that switch audio on and off, but it doesnt change, it remains the same.

and thats the button that i want to switch upon clicking.

got the idea ??

Well the way I gave it to you, you have to have all the file in the same place.

Have you done that?

if your fla is too big to send through here, upload it to your webspace and then tell us the address to your site , such

when you add the fla

Try this one. I have included all the FLA’s and SWF’s.
[I’ve not included the music FLA coz it was just over the limit]

Swap the play and stopped around if that how you want it?

I gave up using the Stop all sound command coz I found it unreliable.

music player.swf is your starting point.

The loop starts straight away.

just wondering kel , how come you don’t use unload movie? instead of using a swf with nothing on it?

I just found that it’s not as reliable.
[I don’t think that was even an option when I first learnt?]

Hey Kel-420, ur last file worked great, it is better than the first.
thanks mate …
and i think it is better to use a blank movie instead of the unload, i dunno, i found it better…

thx guys

Glad it worked for you.
Yeah that first one was an old one.

Anytime mate.