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 of the page (these i will leave without doing anything), other will go to other subpages in my site(these one i have to catch and process in code).
I planned on catching ‘clicking on link’ event to decide what to do, but i can’t do this. I read that by writing
<a href="event:page_adress">
i could catch the event on link:event in old mx:TextArea, but i cant do this here. I tried to manualy add:
addEventListener(TextEvent.Link, functionName)
but it doesnt work.
When i change to catching MOUSE_CLICK event i’m catching the event, but cant parse it to get the needed address.
Anybody have idea how to do it? I doesnt have to stick with TextArea, but component have to download content form TextFlow.
PS I noticed that when i added event:page_adress to the ‘a href’ the link stopped working (that means it probably started throwing events), but i cant catch it…
PS2 TextFlow is imported from external database with
TextFlowUtil.importFromXML
i tried using in link element, click event but it doesnt work:
<a click="myClickHandler(event)">
myClickHandler doesnt run after clicking on link…
OK i found answer on this blog: http://flexdevtips.blogspot.com/2010/10/displaying-html-text-in-labels.html
Bassicly i had to search whole textFlow and in case of founding a Link – adding manually Event to it.
Im posting my code in case that the flexdevtips blog might be down in the future:
and i had to use it in my code like this:
where tt is my textarea with imported textFlow