【问题标题】:TextArea htmlText does not update text property when set (Flex)TextArea htmlText 设置时不更新文本属性(Flex)
【发布时间】:2012-04-30 19:54:06
【问题描述】:

如果在 mx TextArea 上设置 htmlText 属性,则 text 属性将保持“null”,直到手动编辑 TextArea。有没有办法在设置 htmlText 属性后立即更新 text 属性?

例如

textArea.htmlText = str; 跟踪(textArea.text)

结果 = 空

非常感谢, 亚当

【问题讨论】:

  • 在设置htmlText 几秒钟后是否会发生这种情况,例如在实际呈现 html 时?如果是这样,您可以使用超时来获取它
  • 是的,你是对的,谢谢。但是,没有一种方法可以监听文本属性何时更新。 TextArea 的“更改”事件仅由用户更改触发。文档提到更新文本属性时应该触发“textChanged”事件,但是我找不到这样的事件。

标签: apache-flex textarea htmltext


【解决方案1】:

通过在设置htmlText 属性后在textArea 上调用validateNow(),您可以强制立即更新文本属性。

例如

textArea.htmlText = str;
textArea.validateNow();
trace(textArea.text);

result = HtmlToText( str );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-13
    • 2011-09-17
    • 2012-03-01
    相关资源
    最近更新 更多