Xstream
02-24-2006, 08:55 PM
Hi AS friends,
Anyone know how i can split up dynamicly loaded text according to the number of lines that are allowed? I'v managed to make it work after a week of searching and trial and error, but it's based on the amount of characters, what is not what i want because i've got no control over the actual height of the text since the concentration of characters differ per page.
This is what i mean: The Website (http://www.amparanoia.nl/mansan)
This is the code:
System.useCodepage = true;
textLength = 760;
n = 0;
index = n + 1;
homeText.html = true;
homeText.multiline = true;
homeText.wordWrap = true;
homeText.condenseWhite = true;
myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
tarray = new Array();
for (i=0; i<(this.homeText.length/textLength); i++) {
splitvar = this.homeText.substr((i*textLength), textLength);
tarray.push(splitvar);
}
homeText.htmlText = tarray[n];
} else {
homeText.htmlText = "error loading";
}
};
myData.load("mansanText.html");
btLeesMeer.onRelease = function():Void {
homeText.htmlText = tarray[index++];
}
Is it possible to set the number of lines that are allowed and then split the text? I already have been playing with text._height and text.textHeight etc but it's just beyond me. I'm not that advanced in Flash AS yet.
If anyone can help me out here i would be very gratefull!
Thanx in advance.
Xs.
Anyone know how i can split up dynamicly loaded text according to the number of lines that are allowed? I'v managed to make it work after a week of searching and trial and error, but it's based on the amount of characters, what is not what i want because i've got no control over the actual height of the text since the concentration of characters differ per page.
This is what i mean: The Website (http://www.amparanoia.nl/mansan)
This is the code:
System.useCodepage = true;
textLength = 760;
n = 0;
index = n + 1;
homeText.html = true;
homeText.multiline = true;
homeText.wordWrap = true;
homeText.condenseWhite = true;
myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
tarray = new Array();
for (i=0; i<(this.homeText.length/textLength); i++) {
splitvar = this.homeText.substr((i*textLength), textLength);
tarray.push(splitvar);
}
homeText.htmlText = tarray[n];
} else {
homeText.htmlText = "error loading";
}
};
myData.load("mansanText.html");
btLeesMeer.onRelease = function():Void {
homeText.htmlText = tarray[index++];
}
Is it possible to set the number of lines that are allowed and then split the text? I already have been playing with text._height and text.textHeight etc but it's just beyond me. I'm not that advanced in Flash AS yet.
If anyone can help me out here i would be very gratefull!
Thanx in advance.
Xs.