Hi, i've a text with a very long list of words to highlight and calling setTextFormat() one for each word takes ages. There's some way to speedup this operation ? i've tried with a TextField not instantiate in the DisplayObject's list, to bypass the rendering stage but i've founded that the performance are the same. Any ideas ?
if its a htmlText and the words that you wanna to highlight are put in tags like <strong>
you should look at the StyleSheet Object you can define its styles by loading a css file or you can assign the styles like this:
var style:StyleSheet = new StyleSheet();
var strong:Object = new Object();
strong.textDecoration = "underline";
style.setStyle("strong", strong);
I'm going to strongly suggest you take a look at the Text Layout Framework's new mode of handling rich text styling.
Essentially, the TLF has a TextFlow object that contains a model of your text, including all relevant span-specific formatting. This is distinct from the "view" portion of text display, which would be managed (in your case of edit-able text) by a separate flow composer and EditManager.
Thus, you can perform formatting transformations on wide swaths of the text model, and only have the view re-draw itself on command at the very end.