I want to run a function when the enter key is pressed.
I believe the following code is correct:
stage.addEventListener(KeyboardEvent.KEY_DOWN, selectDetect);
public function selectDetect(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.ENTER)
{
..........
.....
..
}
}
However, nothing happens! If I change the code to Keyboard.SPACE it runs when the space bar is pressed. It seems strange to me. Any one else come across this?