IR commands

I need some help with a project that's had me stuck for a while.

It's simple in theory but I just can't get around it.

I'd like to use an IR remote to continuously blink an LED (already figured that out) but I'd like to use the exact same button pushed to make it stop. Essentially, I'd like to keep the commands confined to a single button.

any ideas?

When a variable is a 0 and you detect a button push, set a variable to 1.
When the variable is a 1 flash the LED.
When the variable is a 1 and you detect a button press make the variable a 0.

Thank you! I'll give it a shot.