PDA

View Full Version : ScrollPane: scrollbars will not detect movie clip height (contains dynamic text)


bittman
12-21-2004, 10:38 PM
I've read through just about every ScrollPane post and it seems like a bunch of people are experiencing a similar problem:

When loading dynamic text into a text field contained in a movieclip, the scrollPane is unable to detect the length of the text (e.g. height of the movieclip). Even with scrollbars set to "on" the text won't scroll (a grayed out bar is visible).

//Tried turning the scrollPane "off" and "on" in the same function
myScrollWindow.vScrollPolicy = "off";
myScrollWindow.vScrollPolicy = "on";

//Tried resetting the size
myScrollWindow.setSize(450,200);

//Tried refreshing
myScrollWindow.refreshPane()

//Tried invalidating
myScrollWindow.invalidate()

I've even tried dynamically resizing a movieclip withing the movieclip and that didn't work (probably for the same reason as the text). Does anyone know of a definitive fix?

Something this easy shouldn't be so complicated :)

bittman
01-03-2005, 11:57 PM
I found a scrollPane that works well with dynamic text in the following tutorial: View it here (http://www.flashkit.com/tutorials/Dynamic_Content/ScrollPa-tommkkat-1010/index.php). I basically copied it on to my stage and modified the code.

To make the scrollPane work with actionscript 2.0 you must make the following change. You could probably use getNextHighestDepth() instead but I didn't bother trying:

var rowNum = 0;
//ADD THIS
layer=0;
//END ADD
for (x=0; x<10; x++) {
layer++;

...also you can set your text box to autosize by using the following so that it will adjust for longer content:

myTextBox.autoSize=true;

Hope this helps...