Page 1 of 1

Chat window doesn't always scroll to bottom on new message

Posted: 02 May 2011, 21:17
by jonc
Hi,

Having a problem with the Chat Box. I recently noticed in our game that sometimes when a new message is added to the chat box that the new line doesn't appear because the box doesn't automatically scroll to the bottom. The line is there and you can manually scroll to see it, but this isn't very satisfactory.

The problem is reproducible if you first fill the chat box with messages and then keep typing new messages from the same user. If another user adds a message, the box seems to scroll correctly, presumably because *two* new lines are being added (the name of the user and the message itself). But if you type a new message yourself, only a single line is added (the user name is omitted) and this doesn't seem to trigger the box to scroll, so the new line is not shown. If you keep typing messages, the box will "catch up" but always lag at least one line behind where it should be.

I was wondering if this was something to do with the way we are using the chat box, so I compiled and ran the Lobby example and it has the same problem.

I used the Flex Bits; we are compiling with Flash Builder 4.0.1.

Anyone else seen this problem or have any solutions?

Posted: 02 May 2011, 21:42
by jonc
Answering my own question... hopefully this will be useful for anyone else running into the same problem.

I added a call to ValidateNow() in the code that sets the chat text box vertical position.

This shouldn't be necessary, since the position is being set on a CallLater() function, but it fixed the problem for me.

I removed the CallLater() since it didn't seem to be making a difference.

Posted: 04 May 2011, 18:51
by Bax
Thank you for the info.