hi
i’ve been working on a script that loads some text from an external source and places the text into four ‘overflowing’ dynamic text boxes - like a newspaper column. The script works fine, but if the external text is any greater than 700 words (ish) then Flash will crashes! Can anyone suggest a way to improve my script or a alternative - i wish to use approx 1500 words in the final thing!! See script below:
[AS]// load external text:
_root.box1.text = “…loading!”;
var myData = new LoadVars();
myData.load(“data.txt”);
myData.onLoad = function(ok) {
if (ok) {
box1.text = myData.TextData;
insertText();
} else {
_root.box1.text = “Error!”;
}
};
insertText = function () {
inputBoxText = box1.text;
layoutText = inputBoxText;
short1 = layoutText;
//box1.text = layoutText;
for (i=0; i<layoutText.length; i++) {
if (box1.maxscroll != box1.scroll) {
short1 = short1.slice(0, short1.length-1);
box1.text = short1;
} else {
short2 = layoutText.slice(layoutText.length-i, layoutText.length);
box2.text = short2;
break;
}
}
// overflow for box 3:
for (i=0; i<layoutText.length; i++) {
if (box2.maxscroll != box2.scroll) {
short2 = short2.slice(0, short2.length-1);
box2.text = short2;
} else {
short3 = layoutText.slice(layoutText.length-i, layoutText.length);
box3.text = short3;
break;
}
}
// overflow for box 4:
for (i=0; i<layoutText.length; i++) {
if (box3.maxscroll != box3.scroll) {
short3 = short3.slice(0, short3.length-1);
box3.text = short3;
} else {
short4 = layoutText.slice(layoutText.length-i, layoutText.length);
box4.text = short4;
break;
}
}
};
insertText();[/AS]
Any ideas? Cheers !!