Press button rapidly games (question)

I’m pretty new to flash and I am especially new to programing games.

For part of a school project I am making I want to include a very simple flash game.

The goal of the game would be to prevent yourself from eating a burger. (I’m doing a presentation on the compulsive eating disorder). You would have to press a key rapidly to make a rising bar of hunger go down. If you can keep the bar from filling to the top for a certain amount of time then you win. It’d be great if after a certain amount of the bar is filled the character on the screen starts to sweat and then maybe twitch and then something else before finally leaping on the burger and eating at which point the player would lose.

Thanks,
Mordaut