Only appear on key down

I have a movieclip with two frames. I want it so that if spacebar is being held down go to frame 2, but if isnt pressed then stay on frame 1.

I can’t find a way to detect if key is up. Basically what I want to achieve is something similar to the laser in this game: http://www12.plala.or.jp/nextframe/flash/fire2.html

I’m having trouble with the laser appearing when the key is being held down but then I also need it to disappear when the key is not being pressed.

I hope I explained well enough, thanks for any help. :slight_smile: