PDA

View Full Version : Line-by-Line File Input


SSFSO
07-08-2007, 08:58 AM
I have a talk coming up in a little under a month to present some research I have been doing, and I would like to have a graphical representation of my data. My simulation is coded in FORTRAN, and I output data arrays to a multitude of different text files, which are then read in by IDL line-by-line to produce plots. Now I want to include some graphics and different things to help illustrate what is going on. I could do this easily in C++, which I have some familiarity in object-oriented programming, but I would like to use Flash so I can have pretty graphics.

I know to do this in C++ one simple way would be to do a while loop. My pseudocode would look like...

count=0
while not endoffile
read line
array1(count)=line
count++

...and then I could use the data storred in this array later.

I have been unable to find a way to read files like this in ActionScript, as all the tutorials I have found require specific syntax in the file itself.

Thank you very much for your help.

Flash Gordon
07-08-2007, 10:10 PM
don't think you can read lines. Looks like you are going to have to read the whole data as a string and split() line breaks.

Maybe something like.
var lines:Array = URLLoader.data.split("\n");

SSFSO
07-09-2007, 12:16 AM
That was a great suggestion. Thanks!

Flash Gordon
07-09-2007, 04:21 AM
cool. glad it helped.

Good luck