[FMX] Simplifying setRGB

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?

yeah there is an easier way.

name your buttons like this btn0, btn1, btn2…

then use this AS on each button:

onRelease = function(){
for(i=0;i<10;i++){
myColor = new Color(["btn"+i]);
myColor.setRGB(0x000000);
}
myColor = new Color(this);
myColor.setRGB(0xFF0000);
}

isn’t white 0xFFFFFF

not real important but if your buttons keep turning out black thats why.

heh, yeah, white is 0xFFFFFF… just copying what he had - my bad.