I’m publishing in Flash Player 7 and using the older Flash MX scroll bar component. I just want it to disappear when not needed but
maxscroll
always returns
1
when using trace.
The AS that should work:
sbar._visible = (homeinfo.maxscroll > 1);
but these always return “1” reguardless of the amount of text:
trace("scroll" + homeinfo.scroll);
trace("maxscroll" + homeinfo.maxscroll);
trace("bottomScroll" + homeinfo.bottomScroll);
The textbox has an instance name “homeinfo” and it is a dynamic textbox which loads an html file just fine.
This seems like I’m missing something obvious or am not aware of some incompatibility. Thanks so much in advance!
So let me ask it this way, if i am using the scrollbar component from a previous flash version, and i want to find out if the text box is full, how can i do that in MX / version 7? Thanks!
So i figured it out. I moved the textbox to a few frames sooner than when
maxscroll
starts checking and then it worked. Even though i had the script below the text loading, it still didn’t have enough time to load. Basically i load the text into the box and then a few frames later i test the box to see if it needs the scroller. Hopefully that will help some other poor soul.
Thanks for posting the solution instead of just saying “I figure it out, thanks anyway”. I guarantee this post will help someone at some time. :thumb:
If you’re loading some external text, use the onLoad method of the LoadVars object to check if the file has finished loading.
Could you post an example of how this would work? That sounds like just the thing i need!
I’m just glad i could finally contribute something! I’ve been reading these forums for awhile now and they really have helped me a great deal.
Yea of course:
my_data = new LoadVars();
my_data.onLoad = function(success){
if(success){
my_textfield.text = this.myVar;//assign the content of the textfile to the textfield
trace(my_textfield.maxscroll);//at this point you can make sure the file has been loaded
}
}
my_data.load("my_file.txt");