0 Replies Latest reply on Jul 29, 2007 9:05 PM by Twilight_Knight

    TextRange Performance Problems

    Twilight_Knight
      Hello. I developed a HTML syntax highlighter which uses regular expressions and the TextRange class to color the text inside a TextArea. I tested it with a 30 KB HTML file, and it runs very quickly when I comment out the code that calls the TextRange object. So the algorithm is good. However, when the code runs normally (not commented out), the repeated calls to the TextRange object causes execution to run about 240 times slower! My guess is that Flex is recalculating the entire layout of the TextArea each time a call to the TextRange object is made.

      I only want Flex to render and recalculate the entire layout of the TextArea only once. Does anyone know how I can go about doing this? I setup a process to call the invalidateDisplayList() and validateNow() methods only once during the render event of the TextArea object, but there was only a very slight improvement in performance. I read all the documentation, but can't seem to find what I am looking for. Is there something that I am missing?