all groups > flash actionscript > march 2005 >
You're in the

flash actionscript

group:

paging a TextField


paging a TextField grayooze
3/31/2005 11:39:11 PM
flash actionscript: I have a bunch of htmlText that is too big too fit in a TextField and I want
to move all of the leftover text into another TextField (I need to have
multiple "pages" of text, no scrolling).

I can figure out the bottommost visible line in a TextField
(TextField.bottomScroll) but I don't think I can translate this into an index
of the htmlText string.

Can anyone think of a way to do this?
Re: paging a TextField kglad
4/1/2005 3:31:56 PM
try the following. splitF() should return the html string that overflows from
the textfield passed to splitF().

function splitF(tf) {
mys = tf.htmlText;
for (i=0; i<mys.length; i++) {
tf.htmlText = mys.substr(0, i);
if (tf.maxscroll>1) {
break;
}
}
news = mys.substr(0, i-1);
find = "</TEXTFORMAT>";
ind = news.lastIndexOf(find);
news1 = news.substr(0, ind+find.length);
return mys.substring(ind+find.length);
}
Re: paging a TextField grayooze
4/1/2005 6:50:21 PM
This is a pretty nifty hack, I love it!

Re: paging a TextField kglad
4/2/2005 1:12:40 AM
AddThis Social Bookmark Button