# Reading a text file

**URL:** https://forum.kirupa.com/t/reading-a-text-file/194432
**Category:** flash
**Created:** [July 23, 2006, 1:09pm UTC](https://forum.kirupa.com/t/reading-a-text-file/194432 "2006-07-23T13:09:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![patc4](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@patc4](https://forum.kirupa.com/u/patc4)
#### Post date: [July 23, 2006, 1:09pm UTC](https://forum.kirupa.com/t/reading-a-text-file/194432/1 "2006-07-23T13:09:20Z")

</div>

Hi  
I am new to actionscript, but I know C,C++ some Java, Javascript ASP, PHP.

Since I have learned many different programming languages in the past I have not a little list of short programs I want to be able to in any language ( I have discovered these programs are a good basis to start).

List Item Read a text File:

OK I have read the book(s) and I am afraid too late saw your tutorial when I had already got that far with the usual blood and tears.

I can read a a text file and pop one record of 4 field of data onto a Flash form - but my file has more records and I only see the last one reported.  
It looks like actionscript does not deal in records as return/enter is just passed as data.  
This is my text file:  
&Name=Pat [Proggie&Email=pat@hotmail.com](mailto:Proggie&Email=pat@hotmail.com)&Header=About this 'er Flash feedback form&Msg=This Flash feedback form is the bees knees&  
&Name=Andy [Handy&Email=andyHandy@yahoo.com](mailto:Handy&Email=andyHandy@yahoo.com)&Header=Your site stinks&Msg=Your site stinks carry on I like it!&  
&Name=Able [Cable&Email=able@cabel.net](mailto:Cable&Email=able@cabel.net)&Header=Great Site&Msg=Tell me more.&  
The Code:  
[FONT=Times New Roman]//-------------------------------------------------  
// I expect to read a text file called  
// “feedbackFile.txt” and place data fields into  
// the display form "Reporting Text from a File  
// this code only displays the last record  
// so only 1 record on this file  
// would be OK for input variables like rates/discount values  
//  
feedback\_lv = new LoadVars();  
feedback\_lv.onLoad= onText;  
feedback\_lv.load(“feedbackFile.txt”);  
var sometext = feedback\_lv.toString();  
//  
function onText()  
{  
name\_txt.text = feedback\_lv.Name;  
email\_txt.text = feedback\_lv.Email;  
header\_txt.text = feedback\_lv.Header;  
msg\_txt.text = feedback\_lv.Msg;  
}  
[/FONT]  
Code/form view/notepadview in pdf attachment called “The File”
