blender game enigne

how can i make a flash light turn on and off with the keyboard input

Well you could use python to get key input and change the power of a light with it. There is a code snippet in the online api that shows how to acess light energy. And there are plenty of examples on how to code key strokes.

Keyboard sensor and edit object should work as well.