开发者

Flex 4 adding TextFlow anchor with 'click" event

开发者 https://www.devze.com 2023-03-20 00:55 出处:网络
Given the following: private var errorHtml:String = \"<TextFlow xmlns=\\\"http://ns.adobe.com/textLayout/2008\\\"><p>Existing account, please <a click=\\\"clickHandler(event);\\\">c

Given the following:

private var errorHtml:String = "<TextFlow xmlns=\"http://ns.adobe.com/textLayout/2008\"><p>Existing account, please <a click=\"clickHandler(event);\">click here</a>.</p></TextFlow>";

Then importing it on creationComplete:

errorMessageText.textFlow = TextConverter.importToFlow(errorHtml, TextConverter.TEXT_LAYOUT_FORMAT);

The click handler function never fires. But if I add it directly to the markup:

<s:textFlow>
  <s:TextFlow>
    <s:p>
        Existing account, please <a click=\"clickHa开发者_高级运维ndler(event);\">click here</a>.
    </s:p>
  </s:TextFlow>
</s:textFlow>

The event fires fine. I saw that these events get removed if you try to import as TEXT_FIELD_HTML_FORMAT:

Note: Unlike the TextField class, ActionScript link events are not supported. Neither are a:link, a:hover, and a:active styles.

Are they also removed using TEXT_LAYOUT_FORMAT?


Yea, it gets rid of all the 'FlowElementMouseEvent' events, annoying. Basically after importing you need to go back through and find all the links and then add FlowElementMouseEventhandlers. There's a blog post here: http://flexdevtips.blogspot.com/2010/10/displaying-html-text-in-labels.html which discusses how to do it.

0

精彩评论

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

关注公众号