Skip to main content
Known Participant
March 18, 2010
Answered

Link formatting causing a hang

  • March 18, 2010
  • 1 reply
  • 2816 views

I'm generating a large list of names and flowing them through columns. Each name is a link. This is fine when I use the default styling. As soon as I try to add some formatting with a TextLayoutFormat object the thing takes an age to load and the links become completely unresponsive. I get the spinning icon and then a few seconds later if I'm lucky it will attempt the format on the hover state.

This is going to generate my entire use of the TLF in this project pointless unless I can find a less processor intensive way of formatting these links. Is it not possible to just apply a normal stylesheet to the text so I can at least embed a font and change the colour of the text when I rollover it?

Would it be better to apply the styles inline?

Any help on this appreciated.

This topic has been closed for replies.
Correct answer rdermer

Yea, I figured that out and just styled the • span inline. This relates to another issue with two A tags next to each other creating one link.

I'm using the Configuration class to setup the styles now.

Have you any thoughts on how I can change the colour of the LinkElement by using the FlowElementMouseEvent? When I use this it seems to be pretty responsive at tracing out the LinkElement which suggests it should be able to target it and change it like that. I tried to change the colour of the linkElement on rollover but it didn't do anything.

Any ideas on how I can hack this for the time being? I've hung my entire project off this framework and it's looking like I may have to ditch it just because of a hover state on a link. I'm gutted.


In your example you've got all the links in a single paragraph.  I changed the markup to have all the links in separate paragraphs and the result performs well - see below.  Note I added textAlignLast="justify" cause you had everything set to justify before so this gives the same result.

You've got about 500 links in a single paragraph there and its requiring the TextBlock to be updated on each hover.  That invalidates all the lines.  Changing how you do the styling from the linkNormalFormat to using FlowElementMouseEvents will almost certainly have the same result.

<?xml version="1.0" encoding="UTF-8"?>
<TextFlow xmlns="http://ns.adobe.com/textLayout/2008" whiteSpaceCollapse="preserve" fontSize="12" textAlign="justify" textAlignLast="justify">
   
    <linkNormalFormat><TextLayoutFormat color="#000000" textDecoration="none" fontFamily="hatten" /></linkNormalFormat>
    <linkHoverFormat><TextLayoutFormat color="#999999" textDecoration="none" /></linkHoverFormat>
    <linkActiveFormat><TextLayoutFormat color="#999999" textDecoration="none" /></linkActiveFormat>
   
   
        <p><a href="event:001">Lorem ipsum</a><span color="#ffffff">•</span></p>
        <p><a href="event:002">dolor sit</a><span color="#ffffff">•</span></p>
        <p><a href="event:004">amet consectetur</a><span color="#ffffff">•</span></p>
        <p><a href="event:005">adipiscing elit</a><span color="#ffffff">•</span></p>

     .... etc ...

We can investigate having a large number of links in a single Paragraph further but there's nothing obvious.  I hope this is a sufficent solution.

Richard

1 reply

PoobeardAuthor
Known Participant
March 18, 2010

This happens when you have a lot of A links and you set the format within the XML of your TextFlow. Not inline but at a global level. I guess it has to traverse a tree to find the element and this is taking an age because of the amount of links. I had 500 names as links with a span element in-between each to stop the convertor turning them into all one link.

PoobeardAuthor
Known Participant
March 18, 2010

I tried to force a change of colour on the LinkElement by listening for the FlowElementMouseEvent but the performance was still awful. The only thing I can think of trying is to apply the link formatting inline on every A link. Can you do this?

PoobeardAuthor
Known Participant
March 18, 2010

I've uploaded an example so you can see what's happening here.

I've pushed my textflow into a TextArea component to isolate the issue away from the container flow.

Here's the demo : http://lyraspace.com/transfer/tlf/TextFlow_POC.html

Try and roll over the links (each two word cluster is a link) and notice the hang that occurs when trying to apply the hover format.

Here's the XML that creates that Textflow object : http://lyraspace.com/transfer/tlf/srcview/source/loremipsum.xml.txt

and the class with the textflow creation code in it (very messy at the moment) : http://lyraspace.com/transfer/tlf/srcview/source/TLFTestingSkin.mxml.html

Ignore the font embed stuff. You want line 150.

I've tested this thoroughly now and the issue is purely down the amount of links there are in this flow. This is crazy surely?