Scrollbar Question

In MX I am able to import a ‘.txt’ file but I am stumped on how to make the scrollbar adjust after the dynamic text has been loaded into the text field it is used to scroll for. If anyone knows how to fix his could you please tell me…its very hard to make a Flash Forum when the ****ed scrollbars won’t adjust…on my forums I usually just use the ghetto arrows that scroll the box down.

By adjust, do you mean have the scrollbar’s size (or height) adjust according to the amount of text loaded in the text box? If so, let’s say you have a movie clip containing the dynamic text box and scrollers. Name the scrollbar “scroll” and let’s say for this example, the textbox is called stuff. Place an instance of the MC on the main timeline or wherever you want it. Select it and add the following AS:

onClipEvent (load) {
this.loadVariables (“stuff.txt”);
var numLines = 10;
var totalLines;

We’re just loading text and initializing some variables here. numLines: the most number of lines of text that can be displayed at one time. You can test this by actually typing some text in your textbox and literally counting it. totalLines: the total number of lines the text file has, this is determined by the maxScroll property. Now after that, add this:

onClipEvent (enterFrame) {
if (stuff.maxscroll > 1) {
totalLines = numLines + stuff.maxscroll - 1;
scroll._yscale = 100*(numLines)/totalLines;
stuff.scroll = int(scroll._y/bottom*stuff.maxscroll);

Once your text file has fully loaded and it is multi-lined, stuff.maxscroll will be greater than 1. That will trigger a calculation of totalLines. Once that is accomplished, the yscale of scroll is reconfigured according to the amount of text. The final lines have the scroll of the textbox move when the scrollbar is dragged. It should finally look like this:

<EMBED src=“” WIDTH=“550” HEIGHT=“350”></EMBED>

You can download the source file here. Right click the link and select “Save Target As…” Tripod will give you beef if you simply click on it.

Ooops… I’m doing it the old fashioned way apparently. I just found this tutorial on Kirupa:…roller.asp

ok…renaissance could you explain what I need to do to get a scrollbar to work with text being loaded in. I tried using the code above in my own and it wouldn’t work. Could you please explain the settings I need to have in the properties box of the textbox and exactly what AS i need to use and where…also could you explain keeping in mind i want to use the scrollbar that comes with mx? I’d really appreciate it.

I think what he is trying to say is that…he can get the text to load into the text box but he is having trouble with the srollbar updating its size inversly to that of the text box contents…but im a stupid 17 year old italian…so im usually wrong