How can I turn off a led when releasing a button?

The state change detection example (in the IDE examples) shows how to detect when the button becomes pressed and becomes released (as opposed to when the button is pressed or released).