1
votes

This is the first time i've ever actually gotten to the point where I had to ask for help for a programming issue. I've ran down every lead I can find online regarding this issue to no avail. I've also attempted fixes found by other people having (nearly) the same issue.

Here is the problem:

I have created a flash-chat client and server. Both of them are working as per expected and I have recently decided to display user messages on the flash client as individual movieclip instances, so that I may have more control over each of the messages posted. (Such as user avatars, smilies, ability to remove individual messages, etc.) Previously I simply was using a dynamic textarea with a UIScrollbar, which worked perfectly, but did not allow enough customization or control over message content.

Here's my current setup;

I have a Scrollpane named "msgAreaPane" created in Flash Pro on the stage. When the client loads it creates a Movieclip named "msgAreaContainer", and sets the msgAreaPane source as msgAreaContainer. When a message is to be displayed, it creates a new instance of my "msgElement" object from the library, and adds it as a child of the msgAreaContainer.

All of that is working fine. But the thing is, I can't use a UIScrollbar(as far as I can tell) to properly automatically scroll the msgAreaPane scrollpane, because of property differences such as it not having 'maxScrollV' and etc.

So basically I need to know what I need to change or if i'm going about this the wrong way. Not sure if I should be attempting to scroll the content of the msgAreaContainer or the msgAreaPane, or if I should just set it up differently.

I've tried manipulating the Scrollpane's verticalscrollposition, but can't seem to get it to do anything at all. I have been struggling with this issue for about 2 days and seriously need some help or advice. Thanks ahead of time to anyone willing to help.

1
You should add your solution as an answer and then accept your own answer. This will show it as an answered and accepted question for others searching for as3 questions.Ribs

1 Answers

2
votes

Never mind everyone, I finally figured it out myself after 2 days of no sleep over this one. I'll leave the answer here for others, since I'm sure I'm not the only one who had or will have this issue. Adobe should really make better documentation of object element properties. Anyways, here's how you do it.

msgAreaPane.update();
msgAreaPane.verticalScrollPosition = msgAreaPane.maxVerticalScrollPosition;

If you still have issues for it being instant, make sure your dynamic content is fully loaded by adding an addedToStage event listener for the new child element.