HELP! trying to build a 'highlight' system without using timers

i have a menu with 5 items, alpha set to 0.25
5 global variables are set to match the 5 items:
- item1active
- item2active
- item3active
- item4active
- item5active
Upon clicking one of the items, it highlights (alpha set to 1). All other items will de-highlight.
to achieve this effect, i use timers. Each item has a timer which refreshes every 0.25 seconds, and detects if one of the items is highlighted.
for eg, the logic for item1 is:
for each 0.25 seconds, if NOT item1active, set its alpha to 0.25 to dehighlight
else, set its alpha to 1
the thing is, if i have 50 items, i'll need 50 timers, which makes the app definitely SLOW
any ideas?
5 global variables are set to match the 5 items:
- item1active
- item2active
- item3active
- item4active
- item5active
Upon clicking one of the items, it highlights (alpha set to 1). All other items will de-highlight.
to achieve this effect, i use timers. Each item has a timer which refreshes every 0.25 seconds, and detects if one of the items is highlighted.
for eg, the logic for item1 is:
for each 0.25 seconds, if NOT item1active, set its alpha to 0.25 to dehighlight
else, set its alpha to 1
the thing is, if i have 50 items, i'll need 50 timers, which makes the app definitely SLOW

any ideas?
Answers
set each actor to the correct # am i attribute 1-50 in your case
make each item have a rule if touch is pressed change (game.# item selected) to (self.# am i)
new rule
if (game.# item selected)=(self.# am i)
change aplah to 1
and add this to the
otherwise section
change alpha to .25
this works if you only have one thing you need high lighted at a time. do you need more then one at a time?
doesn't work unfortunately. i need only 1 thing highlighted at a time, but the timer needs to be present to continuously check for user activity ( if user clicks on another button ). Try it yourself.
i'm trying to devise a timer-free method.
Ace
pretty sure its the most efficient way, if you can confirm or deny id be happy to learn
btw ace I've tried to find your music and games? googling your name didn't come up with them... do you have a site where it displays it?
My band is called Ellerker - http://www.ellerker.net and here's a sneaky preview of our latest video that's no where near finished - a drum fill is out of time, the chants ending is too cheesy and a few other bits and bobs need changing:
As for apps, I used to have an account on iTunse in my brother's name, now he just uses it for whatever he uses it for as I've set up mynameisace ltd. and going to be uploading new apps to there. Most of the work I've been doing for the past 10-12 months have been paid work for other people.
Ace
If you want to add a deselect, just change the current touch is pressed behaviour to 'if touch is pressed and color.alpha = 0.25' then add in another rule saying when touch is pressed and color.alpha = 1 change attribute "game.whatever the attribute is called that matches to the self attribute" to 0.
Ace
Ace