0

I'm building a chat room with Flex. Although my flex application contains a lot more (like users list, other buttons), most of the application is based on a text area, a textinput and a button (labeled Send). When a users writes something in the textinput and presses the Send button (or Enter), he sends a message to all other users in the room. The TextArea is the place where all messages go...

Now, my problem is that when the TextArea starts getting big (there is a lot of text in it), the application is starting to respond slowly. I'm using the .htmlText property of the TextArea to set the text because I want the lines where the users nickname is mentioned to get highlighted in the TextArea. What can I do to fix this? Can I somehow extend the TextArea to make it more responsive (because I don't need all the functionality of htmlText, I just need to make part of the text bold, or in different color), or is my only option to trim part of the TextArea text (for example, If it's length get's over 10000 charaters, remove the first half of them)... Is there a better component than TextArea for this purpose?

Petar
  • 51
  • 1
  • 6

1 Answers1

0

For how long do you need to keep the text in the chat? Why not just remove the oldest lines?

This seems to be a known problem. And there seem to be older questions on the subject. e.g. Pasting a large amount of text in a TextArea leads to a script execution timeout

Also found this on Adobe's forums: TextArea gets very slow after text amounth gets larger

And: Poor performance using TextArea

Community
  • 1
  • 1
Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203
  • I'm already considering removing the oldest lines, but my question is whether or not there is a way to avoid using .htmlText, because even if I just want to change the font of 1 line with , AS3 is changing my code so that every line now contains 5 more tags - like ,

    , ..., so a line having 10 characters now has 100 characters. I believe that's what's killing me, and I need a way to avoid it.

    – Petar Dec 25 '10 at 18:36