Form and enter key

I need to be able to press the enter key for my form to work. I got this code from another thread:

 Key.addListener(myListener);
	EnterKeyListener = new Object();
	EnterKeyListener.onKeyDown = function() {
		if (Key.getCode() == "13") {
			//code
		}
	};
	Key.addListener(EnterKeyListener);



and then I put it on my submit button like this:



on (release, keyPress "<Enter>") {
	mess = "Sign in please!";
	if (username == "CSI555") {
		mess = "Invalid password";
	}
	if (password == "CSI555") {
		mess = "Invalid username";
	}
	if (username == "CSI555" & password == "CSI555") {
		gotoAndPlay("administrativetools");
	}
	myListener = new Object();
	myListener.onKeyDown = function() {
		if (Key.isDown(Key.ENTER)) {
			//code
		}
	};
	Key.addListener(myListener);
	EnterKeyListener = new Object();
	EnterKeyListener.onKeyDown = function() {
		if (Key.getCode() == "13") {
			//code
		}
	};
	Key.addListener(EnterKeyListener);
}

but it doesn’t work. I’m not sure where to put it, or how to make it work. Please help!!

Thank you.
ashley