# \[FMX\] Simplifying setRGB

**URL:** <https://forum.kirupa.com/t/fmx-simplifying-setrgb/94038>\
**Category:** Uncategorized\
**Created:** [November 7, 2003, 6:26pm UTC](https://forum.kirupa.com/t/fmx-simplifying-setrgb/94038 "2003-11-07T18:26:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maizoon](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@Maizoon](https://forum.kirupa.com/u/Maizoon)\
**Post date:** [November 7, 2003, 6:26pm UTC](https://forum.kirupa.com/t/fmx-simplifying-setrgb/94038/1 "2003-11-07T18:26:20Z")

</div>

Is there an uber easier way of doing this?

I have 5 buttons, when you release a button I want it to stay red and the others go back to white. Right now I have this script on each of my buttons:

[AS]  
btnOne.onRelease = function() {  
myColor = new Color(btnOne);  
myColor.setRGB(0xFF0000);  
myColor = new Color(btnTwo);  
myColor.setRGB(0x000000);  
myColor = new Color(btnThree);  
myColor.setRGB(0x000000);  
myColor = new Color(btnFour);  
myColor.setRGB(0x000000);  
myColor = new Color(btnFive);  
myColor.setRGB(0x000000);  
};  
btnTwo.onRelease = function() {  
myColor = new Color(btnOne);  
myColor.setRGB(0x000000);  
myColor = new Color(btnTwo);  
myColor.setRGB(0xFF0000);  
myColor = new Color(btnThree);  
myColor.setRGB(0x000000);  
myColor = new Color(btnFour);  
myColor.setRGB(0x000000);  
myColor = new Color(btnFive);  
myColor.setRGB(0x000000);  
};  
[/AS]

So on and so forth for each button…Is there a simpler way of doing this or do I Have to put these 10 lines of code into each button?
