Hit ENTER to have an Action

Hello,

For an input field - i need to have some action when user enters something in the input field and hit ENTER.

I am using this: but with this user can hit enter anywhere on the screen and get the action- i need to have it only when user selects the input field.

myNewObject = new Object();
myNewObject.onKeyDown = function() {
 if (Key.isDown(Key.ENTER)) {
     trace("do something")
 }
};
Key.addListener(myNewObject);

PLEASE HELP.