AS3 Listen for the Enter Key to be pressed

Here’s a little Flash AS3 snippet that listens for the pressing of ENTER key using the Keyboard even listener.

this.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyEnterHandler);
function keyEnterHandler(event : KeyboardEvent) : void
{
if (event.keyCode == Keyboard.ENTER)
{
returnSavings_mc.visible=true;
}
}