Checking if a key is down?

Hi, I’m trying to make a code that checks if the enter key is down, then a function will run every second.

I’ve tried:

if (key.isDown(key.ENTER) {
setInterval(rectDecrease,1000);
}

How would I make flash constantly check this instead of just once?