Simple Key on, off and on again...!

Hi, I can not get a simple operation with GS. I want to create
a button-shaped bulb. When the button is not pressed is
off, stays on when pressed. If I press it again
off.
So: button is Off > touch and becomes On.
button is On > touch and becomes Off.
You have solutions on this?
I tried this way but not working as it should:
Rule: "Actor receives event" "touch" is "Pressed"
Change Image: "Set Image to: bulb_on.png
Rule: "Actor receives event" "touch" is "Released"
Change Image: "Set Image to: bulb_off.png
thanks!
a button-shaped bulb. When the button is not pressed is
off, stays on when pressed. If I press it again
off.
So: button is Off > touch and becomes On.
button is On > touch and becomes Off.
You have solutions on this?
I tried this way but not working as it should:
Rule: "Actor receives event" "touch" is "Pressed"
Change Image: "Set Image to: bulb_on.png
Rule: "Actor receives event" "touch" is "Released"
Change Image: "Set Image to: bulb_off.png
thanks!
Comments
Attribute called onoff.
When touch is pressed and when self.onoff is true, change attribute to false, change image (to off version).
When touch is pressed and when self.onoff is false, change attribute to true, change image (to on version).
:-)
First
When actor receives touch change attribute onOff to (onOff +1)%2. This will cause the value to switch between 0 and 1.
After that create another rule. When onOff is 0 change image to off.png otherwise change to on.png
That should work
Rule
When touch is pressed
Change attribute self.switch to (self.switch +1)%2
New rule when self.switch = 0
do blah blah
Otherwise
Do blah blah blah
EDIT: didn't read mulcahy's post closely! Like he said
on touch
self.switch to (self.switch+1)%2
self.image to self.switch .. self.file (where self.file is a text attribute with .png)
Change Attribute: self.Image to: self.switch..".png"
http://gamesalad.com/forums/topic.php?id=86#post-328
good luck!