Groups | Blog | Home
all groups > flash actionscript > march 2004 >

flash actionscript : populate an array with all the words of a text fil


Chayah
3/8/2004 7:30:50 PM
I need to populate an array with all the words of a text file. In other words,
I need to take all the words in a text file, or preferably the contents of a
text box in my flash movie, and make each word separate values in an array in
my flash movie.
Can any one help explain how to do this or direct me to a resource that
explains how to do this?

thanks

jeffczyz
3/8/2004 8:21:36 PM
You can use String.Split(). That puts all of the split words into an array
based on your delimeter.

In your case:

var mySplitStringAry = myTextBox.text.split(" ");
for (i=0; i < mySplitStringAry.length; i++) {
trace(mySplitStringAry[i]);

}

Jeff



Carl Fink
3/8/2004 8:54:30 PM
[quoted text, click to view]

You'd probably also want to strip out (and split at) punctuation marks
AddThis Social Bookmark Button