FLEX:How to catch 'a href' event

前端 未结 3 690
南旧
南旧 2021-01-25 09:56

I\'m loading data from TextFlow to spark:TextArea. In TextFlow i have \'a href\' elements. Problem lies with the address of the \'link\' elements. Some of them will go outside o

3条回答
  •  礼貌的吻别
    2021-01-25 10:04

    just found out how to get the original string:

    function onClick(event:FlowElementMouseEvent):void 
    {
        var link:LinkElement = event.flowElement as LinkElement;
        var text:String = link.href;
    }
    

    this will return the content of the tag, so you can parse to get your parameters

    thanks for the post, it helped me a lot. at least i got one step further, i can actually listen to the events.

    but i still have a problem, the HTML code i set on my RichEditableText looks like this:

    Name
    

    on Flex3 i could use the TextEvent.LINK get the arguments by its 'text' property, then parse to get the ID data that i need. but now that we are developing in Flex4 i cannot figure out how to do this. after catching the FlowElementMouseEvent i can only get the link text ('Name'), but not the arguments im sending on the HTML code.

    do you have any suggestions on how to do this?

提交回复
热议问题