Actionscript- double click to select a word in a textfield?
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:
- Set doubleClickEnabled=true on the TextField.
- Add a listener for the DOUBLE_CLICK.
- When the listener fires, convert the event's (x,y) to a character index by using TextField.getCharIndexAtPoint.
- Search before and after that point for either a space or string end/begin and use those two values to set the selection index.
精彩评论