
Actionscript Tips for Chat Clients The Autoscrolling Chat Window: Most chat clients automatically scroll the content of the chat window when a new message arrives. This ensures that all of the new messages are immediately viewable. It would be nice if this feature was incorporated into your Flash client. I have a simple solution that uses the Flash MX textfield's onScroller event handler. Here is the code: // This will automatically scroll the chat text // down when new text arrives chatText.onScroller = function () { while( chatText.scroll < chatText.maxscroll ) { chatText.scroll++; } } Send a Message with the Enter Key: Rather than having to use the mouse to click a button every time you want to send a message, it would be much easier to just hit Enter and be done with it. Fortunately, this is relatively easy to do using the new Key object and listeners. Here is the code: // Listens for ENTER key to be pressed enterListener = new Object(); |