开发者

Flex 4 detect if user presses enter key

开发者 https://www.devze.com 2023-01-15 17:08 出处:网络
The secnario is simple if the user presses enter while in the password field, I would开发者_如何学Python like to submit the login for for processing.

The secnario is simple if the user presses enter while in the password field, I would开发者_如何学Python like to submit the login for for processing.

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

Thanks in advance


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消