AS2 Game lags when key is pressed

Hello!
I’m working on a “storm the house” game and there is a really annoying bug wich causes the game to lag whenever I press a key on the keyboard.
This is a pretty big problem since you reload with Space and swap weapons with the number keys.

Any ideas?