Awesome tutorial!
I now have a working chat room using php sockets with a simple flash GUI. Now I'm going to tear this program apart and add in a bunch of features and connect it to my web sites database for an ultimate chatting experience.
However, I have a problem already, on my first obstacle! I can't figure out how to get the vertical scroll bar to scroll when a new message is sent.
I read through the flash help and there are so many options I could use. I don't know which one I want. This looked kind of promising:
Code: Select all
/**
Requires:
- UIScrollBar component in library
*/
// Create the text field.
this.createTextField("my_txt", 10, 10, 20, 200, 100);
my_txt.wordWrap = false;
my_txt.text = "Mary had a little lamb whose fleece " +
"was white as snow and everywhere that Mary went the " +
"lamb was sure to go."
// Create scroll bar.
this.createClassObject(mx.controls.UIScrollBar, "my_sb", 20);
my_sb.horizontal = true;
// Set the target text field for the scroll bar.
my_sb.setScrollTarget(my_txt);
// Size it to match the text field.
my_sb.setSize(my_txt._width, 16);
// Move it to the bottom of the text field.
my_sb.move(my_txt._x, my_txt._y + my_txt._height);With all that said, how can I get the scroll bar to scroll down vertical (equivalant to javascripts scrollIntoView(false);), or what methods/proprties of the UIObject should I be looking at?[/syntax]