PDA

View Full Version : loading text into columns



jerryj
January 21st, 2005, 06:42 PM
hi,
does anyone know if you can load text from an external textfile into two columns, going to the second when the first is filled??

I only found this (okay, three columns, but I mean the text here is not externally loaded)


article = "The Norwegian hacker famous for blablabla.";
words = article.split(" ");
targetColumn = 1;
for (i=0; i<words.length; i++) {
this["col"+targetColumn].text += words[i]+" ";
if (this["col"+targetColumn].maxscroll>1) {
i--;
targetColumn++;
}
}
Maybe I could load my external text into such a string, does anyone jnow how to do that?

Thank you,
Jerryj.

brainy
January 22nd, 2005, 04:45 PM
You can load an external file using the XML Object (http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary827.html)

Something like this quick sample code:

var oXML=new XML();
oXML.load("myfile.txt");
oXML.onData=function (src) {
trace(src);
}