Hi there, I'm creating a flash game, and would like to know if anyone knew how to add lives?

Basically a level is run in a single frame, and images of hearts will be in the corner. When all the lives are lost, the game must go to a different frame (e.g. the menu). I would like to have 10 lives, and whenever a life is lost, a heart to disappear, but the frame cannot change.

Can anyone help please?