tags:

views:

159

answers:

2

Hi,

The secnario is simple if the user presses enter while in the password field, I would like to submit the login for for processing.

How can I detect that event from with in the specific text box.

Thanks in advance

+2  A: 

You don't need to worry about keyPress events in this case. TextInput conveniently dispatches an enter event when user presses enter.

<mx:TextInput id="passwd" displayAsPassword="true" enter="submit()"/>

Script:

private function submit():void
{
  var pw:String = passwd.text;
  //submit the login here.
}

This is applicable for spark TextInput also.

Amarghosh
Awesome I didnt know that, thanks again Amarghosh :)
Craig Mc
now just waiting so I can tick your answer, I hate all these delays, I guess people have been scripting ways to spoof points, but in 6 minutes I can give you the tick :)
Craig Mc
A: 

keyDown="if (event.keyCode==Keyboard.ENTER){ userRequest.send();}"

Craig Mc