|
-
Hi guys,
The problem elements are like this
a)I have a text file that contains strings.each string has special characters($)that will come into play later
eg var1=/"this is a string.$mayavi$2001/"&var2=...etc..
&datacomplete=yes
I need to
a)capture these variables in an array say new primary();
b)detect the end of data in file.
c)split this primary array elements along the special characters and populate secondary arrays.
eg primary[0]="this is a string.$mayavi$2001" ;
text[0]="this is a string";
author[0]="mayavi";
year[0]="2001";
can some kind soul help another in distress.
thanx guys
-
come on guys I m desperate
somebody please help. I am desperate on this .
thanx,
mayavi
-
-
proud new daddy!
Well, for starters it looks like you need to use the split() function. Look at this code:
primary[0]="this is a string.$mayavi$2001" ;
splitPrimary = new Array();
splitPrimary = primary[0].split("$");
And then you have an array, splitPrimary, that has three values, [0] is "this is a string.", [1] is "mayavi", and [2] is "2001". You could then just write more code to assign these values to your other arrays.
hope this helps!
-
thanx fx
Thanx LuxFx it works great now, but still having problems capturing the external variables into arrays.
Do u have any pointers in that direction?
cheers,
mayavi
-
proud new daddy!
Whenever I pull in an external variable to be used as an array, I format it like this in the text file:
arrayString=var1|var2|var3|var4|var5
And in Flash, after this imported, I use the split() function to turn it into a real array, like this:
myArray = arrayString.split("|");
The trick is to use a character that is hardly ever used anywhere else, so I use the pipe. You might have had problems using a '$'.
Is this going to help?
-
hey it helps
thanx a lot i does work luxfx..
cheers,
mayavi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|