Really Dumb question

I feel so embarrised by this question but I just don’t understand why it doesn’t work, what I want to do is simple enough so here goes.

I want my projector to close when I hit the spacebar…
So I create a button off stage and put in this code:

on (keyPress "<Space>") {

But nothing happens where am I going wrong…