views:

107

answers:

2

I have a number of very poor-quality pdf documents that look like 80's photocopies, which I'm rebuilding in Flash (Flex Builder 3 MXML application), representing paragraphs of text in TextAreas so that selected portions can be bold or italic, or whatever I need. I need a way to apply toolTips or event listeners to individual words within the block of text to link those words to a glossary. I'm perfectly happy to create a definition panel that is populated and made visible with a mouseOver, but don't know how to do it to just a portion of the text.

Is there a good / clean / easy way to do this?

A: 

I haven't tried this out in AS3 yet, but the way in which I had to do similar things in AS2 was to use multiple TextFormat()s, which is pretty much a nightmare. At one point I had to redefine the strings that would be redrawn and re-contextualize them (number of characters were different) so that they could be highlighted or bold'd etc. I would not recommend this method. On the brighter side, CSS is fairly "native" in Flex, so I would recommend looking into options for redefining your text pieces w/r/t those styled elements. To be honest, the more I use the built in functions for text in Flex, the more I want to just code straight HTML/CSS/JS instead and use SWFobject instead. YMMV.

jml
A: 

Hello,

If I understand correctly, your main problem is to have different tooltip for different parts of text in textArea.

Question very close to this one was answered here (Haven't looked very closely, but looks like:) ): http://stackoverflow.com/questions/1222675/flex-listening-for-hover-over-link-in-text-area

The only difference would be some array with pairs of string position in text area - tootl tip text and while user MOUSE_OVER the textArea, function counts what position is user over and looks up in array for adequate tooltip.

Hope it helps a bit :)

Adam Kiss