# How do I create buttons that shows that I clicked on them

**URL:** <https://forum.kirupa.com/t/how-do-i-create-buttons-that-shows-that-i-clicked-on-them/62137>\
**Category:** Uncategorized\
**Created:** [August 25, 2004, 7:35am UTC](https://forum.kirupa.com/t/how-do-i-create-buttons-that-shows-that-i-clicked-on-them/62137 "2004-08-25T07:35:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Bolero](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Tony\_Bolero](https://forum.kirupa.com/u/Tony_Bolero)\
**Post date:** [August 25, 2004, 7:35am UTC](https://forum.kirupa.com/t/how-do-i-create-buttons-that-shows-that-i-clicked-on-them/62137/1 "2004-08-25T07:35:25Z")

</div>

I have a menu that have four buttons; start, about me, portfolio and contact.  
If the visitor hover above the buttons they change color and when I click on one of them the button should change to a different color and **stay that way** until I click on one of the others. Just to show people where they are.

But the code just get so big. I have to add code to each and all of buttons telling them what to do if I click on them and not the others and when hovering above them.

Is there a easier way to just collect the code and put it to a single frame or something? I know how to work with if/else and variables but that´s pretty much it when it comes to ActionScripting.

Best regards Jonas

---

<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:** [August 25, 2004, 8:17am UTC](https://forum.kirupa.com/t/how-do-i-create-buttons-that-shows-that-i-clicked-on-them/62137/2 "2004-08-25T08:17:51Z")

</div>

Hiya,

just follow my example and you’ll be fine. This makes the last clicked button inactive. Check it out.

[Download \>\> LastClickedButton.fla](http://www.dataworks.org.uk/LastClickedButton.fla)

Any questions just ask me.

Ads.

---

<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:** [August 25, 2004, 8:21am UTC](https://forum.kirupa.com/t/how-do-i-create-buttons-that-shows-that-i-clicked-on-them/62137/3 "2004-08-25T08:21:48Z")

</div>

Try out this…simple you can increase the number of MCs passed

Int this code and b1 and b2 are the MC on the stage with two frames. We’ve added stop() on the each frames to avoid loop. Write the code on the first frame…

```auto
  
function findClick(firstmc, lastmc) {
  firstmc.gotoAndStop(2);
  lastmc.gotoAndStop(1);
}
/:b1.onRelease = function() {
 findClick(_root.b1, _root.b2);
};
/:b2.onRelease = function() {
 findClick(_root.b2, _root.b1);
};

```

see the attached file

---

<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:** [August 25, 2004, 8:30am UTC](https://forum.kirupa.com/t/how-do-i-create-buttons-that-shows-that-i-clicked-on-them/62137/4 "2004-08-25T08:30:29Z")

</div>

Yaa…as-clark20’s idea is good… more compact

---

<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:** [August 25, 2004, 8:49am UTC](https://forum.kirupa.com/t/how-do-i-create-buttons-that-shows-that-i-clicked-on-them/62137/5 "2004-08-25T08:49:49Z")

</div>

Jesus Christ, how good! Thank you both!
