I'd just use a variable. For example you could call it "hidden". Here's a possible implementation. You could use a boolean instead as well. You can also reduce it to just two events if need be.
On key pressed
-- sprite: set hidden to 1-self.hidden
Sprite: hidden = 0
-- set opacity to self.opacity - 50*dt
Sprite: hidden = 1
-- set opacity to self.opacity + 50*dt