【问题标题】:How to get caretIndex from a TextArea as TextField如何从 TextArea 获取 caretIndex 作为 TextField
【发布时间】:2013-08-23 18:53:58
【问题描述】:

我看到很多使用 .caretIndex 来获取 TextField 文本中光标索引的示例,但我使用的是 TextArea 并且没有这样的属性,只有选择索引。那么如何从 TextArea 中获取光标索引位置呢?

编辑:好的,我做了一个测试,selectionBeginIndex 正在返回一个值。使用它是否“正确”,或者有什么特定的方法?

【问题讨论】:

    标签: actionscript-3 textarea


    【解决方案1】:

    你可以使用selectionBeginIndex

    根据Adobe's documentation:

    If there is no selection, this value is set to the position of the caret.

    【讨论】:

    • 谢谢,有使用正确属性的保证就好了。这个文档翻译成我的语言不好,如果没有选择,该值设置为“circumflex”,默认为零,但英文版毫无疑问。
    猜你喜欢
    • 2017-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多