开发者

Actionscript- double click to select a word in a textfield?

开发者 https://www.devze.com 2023-04-04 22:38 出处:网络
Can someone tell me how I might enable double clicking to select a word in a inp开发者_如何学运维ut textfield?It should do this by default if you are using a TextField with type TextFieldType.INPUT. I

Can someone tell me how I might enable double clicking to select a word in a inp开发者_如何学运维ut textfield?


It should do this by default if you are using a TextField with type TextFieldType.INPUT.


If Spencer's idea doesn't work you could do the following:

  1. Set doubleClickEnabled=true on the TextField.
  2. Add a listener for the DOUBLE_CLICK.
  3. When the listener fires, convert the event's (x,y) to a character index by using TextField.getCharIndexAtPoint.
  4. Search before and after that point for either a space or string end/begin and use those two values to set the selection index.
0

精彩评论

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