# Switching buttons on click

**URL:** <https://forum.kirupa.com/t/switching-buttons-on-click/12817>\
**Category:** Uncategorized\
**Created:** [February 5, 2003, 12:26am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817 "2003-02-05T00:26:17Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![elietabet](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@elietabet](https://forum.kirupa.com/u/elietabet)\
**Post date:** [February 5, 2003, 12:26am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/1 "2003-02-05T00:26:17Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 12:40am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/2 "2003-02-05T00:40:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 12:50am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/3 "2003-02-05T00:50:40Z")

</div>

thanks buddy …

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 12:55am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/4 "2003-02-05T00:55:38Z")

</div>

Anytime :bandit:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 8:54am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/5 "2003-02-05T08:54:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 2:21pm UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/6 "2003-02-05T14:21:05Z")

</div>

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.

```auto

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

```auto

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

```auto

stop();
stopAllSounds();

```

and on the button

```auto

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! 😏

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 8:18pm UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/7 "2003-02-05T20:18:42Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 8:22pm UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/8 "2003-02-05T20:22:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 8:41pm UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/9 "2003-02-05T20:41:30Z")

</div>

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 ??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2003, 9:34pm UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/10 "2003-02-05T21:34:28Z")

</div>

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

Have you done that?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 12:38am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/11 "2003-02-06T00:38:41Z")

</div>

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

> **[Bookmark | AI-Powered Free Website Builder. Create Your Free Website!](https://www.bookmark.com/)**
>
> Create a free website with Bookmark AI Powered Free Website Builder. Choose your website type, your AI design assistant will create your website in 30 seconds.

when you add the fla

> **[Bookmark | AI-Powered Free Website Builder. Create Your Free Website!](https://www.bookmark.com#5aaaf328e2407)**
>
> Create a free website with Bookmark AI Powered Free Website Builder. Choose your website type, your AI design assistant will create your website in 30 seconds.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 12:43am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/12 "2003-02-06T00:43:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 1:08am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/13 "2003-02-06T01:08:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 1:15am UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/14 "2003-02-06T01:15:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 8:45pm UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/15 "2003-02-06T20:45:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2003, 9:02pm UTC](https://forum.kirupa.com/t/switching-buttons-on-click/12817/16 "2003-02-06T21:02:39Z")

</div>

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

Anytime mate.
