Okay Folks -
Long time lurker, first time poster.
I have a movie that loads a number of delimited strings from text files.
I use loadVariables to bring in, say, strings.txt. This file contains a number of delimited variables thusly:
strng1=foo1$foo2$foo3$foo$&
strng2=fie1$fie2$fie3$fie4&
etc...
The goal is to create and populate a multidimensional array using a for loop. Here is a snippet of code that doesn't work, but represents what I'm trying to accomplish:
for (i=0; i<myotherarray.length; i++) {
j=0;
str = "strng"+(i+1);
strn= str.split("$"
;
set(anarrayname, new Array(new Array(strn[j],strn[j+1],strn[j+2],strn[j+3],strn[j+4])));
}
So, when tested as written above, anarrayname[0][0] will return the literal value of str. Also, anarrayname[0] will return an array with the literal value of str as the first element and the rest undefined.
If I replace
strn= str.split("$"
;
with
strn= [str].split("$"
;
none of the array locations are populated.
Obviously, what I want if for str to be recognized as the name of a string, so that the .split will be performed on the correct string and populate the array. Just can't seem to make it happen.
HELP!!??!!
Long time lurker, first time poster.
I have a movie that loads a number of delimited strings from text files.
I use loadVariables to bring in, say, strings.txt. This file contains a number of delimited variables thusly:
strng1=foo1$foo2$foo3$foo$&
strng2=fie1$fie2$fie3$fie4&
etc...
The goal is to create and populate a multidimensional array using a for loop. Here is a snippet of code that doesn't work, but represents what I'm trying to accomplish:
for (i=0; i<myotherarray.length; i++) {
j=0;
str = "strng"+(i+1);
strn= str.split("$"
set(anarrayname, new Array(new Array(strn[j],strn[j+1],strn[j+2],strn[j+3],strn[j+4])));
}
So, when tested as written above, anarrayname[0][0] will return the literal value of str. Also, anarrayname[0] will return an array with the literal value of str as the first element and the rest undefined.
If I replace
strn= str.split("$"
with
strn= [str].split("$"
none of the array locations are populated.
Obviously, what I want if for str to be recognized as the name of a string, so that the .split will be performed on the correct string and populate the array. Just can't seem to make it happen.
HELP!!??!!