Flex中如何通过监听focusIn和focusOut事件,在通过displayAsPassword属性固定密码格式显示文本框获取焦点时显示文本...

main.mxml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"
  3. layout="vertical"
  4. verticalAlign="middle"
  5. backgroundColor="white">
  6. <mx:Script>
  7. <![CDATA[
  8. import mx.controls.Alert;
  9. import mx.managers.PopUpManager;
  10. private var alert:Alert;
  11. private function submit_click():void {
  12. alert = Alert.show("Closing in 3 seconds.",
  13. "Submitting...");
  14. setTimeout(closeAlert, 3000);
  15. }
  16. private function reset_click():void {
  17. alert = Alert.show("Closing in 1 second.",
  18. "Resetting...");
  19. username.text = "";
  20. password.text = "";
  21. setTimeout(closeAlert, 1000);
  22. }
  23. private function closeAlert():void {
  24. PopUpManager.removePopUp(alert);
  25. }
  26. ]]>
  27. </mx:Script>
  28. <mx:Paneltitle="Login">
  29. <mx:Form>
  30. <mx:FormItemlabel="Username:" required="true">
  31. <mx:TextInputid="username"
  32. text="JohnDoe"
  33. maxChars="16"/>
  34. </mx:FormItem>
  35. <mx:FormItemlabel="Password:" required="true">
  36. <mx:TextInputid="password"
  37. text="p455w0rd"
  38. maxChars="16"
  39. displayAsPassword="true"
  40. focusIn="password.displayAsPassword = false;"
  41. focusOut="password.displayAsPassword = true;"/>
  42. </mx:FormItem>
  43. </mx:Form>
  44. <mx:ControlBarhorizontalAlign="right">
  45. <mx:Buttonid="submit"
  46. label="Submit"
  47. click="submit_click();"/>
  48. <mx:Buttonid="reset"
  49. label="Reset"
  50. click="reset_click();"/>
  51. </mx:ControlBar>
  52. </mx:Panel>
  53. </mx:Application>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值