Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data from text file, w/o generator

Status
Not open for further replies.

quickblueink

Technical User
Apr 5, 2001
57
US
Ok, I have a text file that is actually a tab delimited excel spreadsheet. It has 20 fields and about 2000 lines. I want to parse this file into a flash object, so that i can display them. Here's the problem: I can't use a webserver or any server side scripting to do it.

I want to build a flash movie that will read from this textfile, but i want to be able to run it from a cd or someones hard drive, without worrying about whether or not they are running a webserver, any program interfaces (perl interpreter, ASP, etc), or generator on their machines.

The movie will read from the text file and put each line into an object such that it will look like

fileContents.row1.field1 = [1st field on 1st row]

any idea how to read this text file with just it and the flash player? Thanks,

M.austin
 
basics

assuming you are using mx
flash frame 1

lv = new Loadvars()
lv.onLoad = function(){
mydata = lv.data.split(","); //comma delimted
}
mydata.load("something.txt")

//you may have to insert a variable name into the text file in the first line. something like &data=
the ampersand is important

each piece of data is now an element in an array, mydata, and can be accessed through the array index

depends what the data looks like at this time as to how you proceed. if the first 20 pieces are column headings then you would step through the data a row at a time (for loops). if first 2000 is 1 column then the structure of the loop will change.

hope this gets you started
 
Thanks, billWatson. It seems that mx has more capability for using outside resources than 5, which im running now. I just got mx but haven't installed it. I'll install it and give it a whirl, but will probably have more questions.

Thanks again,
M.austin Thornburg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top