# Button Color Change

**URL:** <https://forum.kirupa.com/t/button-color-change/71424>\
**Category:** Uncategorized\
**Created:** [November 24, 2004, 6:40pm UTC](https://forum.kirupa.com/t/button-color-change/71424 "2004-11-24T18:40:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlLife](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@rlLife](https://forum.kirupa.com/u/rlLife)\
**Post date:** [November 24, 2004, 6:40pm UTC](https://forum.kirupa.com/t/button-color-change/71424/1 "2004-11-24T18:40:30Z")

</div>

I am changing a color of a button when clicked. How every i have ten buttons. Each instance name is like this Person1… Person2 etc.

I can change the color of the button when clicked, however I want to make sure when you click on a different button, it changes the previous button back to its original color.

I know i can do this the ghetto way and list out all the buttons i want with no color each time but if later i have 50 buttons i dont want to list them. So i built a loop but the loop is not working right. Can someone help?

This code is an example of what might be on the first button:

```auto
on(release){
	for(i = 0; i<11; i++){
	var tmpPerson = new Color("Person"+i);
    tmpPerson.setRGB(0xFFFFFF);
	trace(tmpPerson);
	}
	//set the color for the clicked item here 
	var ryansNewColor = new Color("person1");
	ryansNewColor.setRGB(0x003366);
}

```
