# Load \*.txt files to fielda (textbox)?

**URL:** <https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051>\
**Category:** Uncategorized\
**Created:** [February 19, 2004, 4:50am UTC](https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051 "2004-02-19T04:50:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinop](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@dinop](https://forum.kirupa.com/u/dinop)\
**Post date:** [February 19, 2004, 4:50am UTC](https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051/1 "2004-02-19T04:50:35Z")

</div>

Probably a stupid question - Way too many coffees today and cannot get this to work… ok…

this is what I dont know how to do… [MX 2004]

When [onrelease] of button 1 I want button1.txt to be displayed within my dynamic text field [box]

the same would go if user hit button 2…

any advice/ideas

thanks kindly:ogre:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 19, 2004, 5:14am UTC](https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051/2 "2004-02-19T05:14:49Z")

</div>

gotta use loadVars baby, works like a charm. Check the tutorials.

I’m not sure if I remember it perfectly, but it will go something like this.

```auto
getText = new.loadVars();
getText.load("yourFile.txt");

button1.onRelease(yourField.text = getText.txtVar);

```

Where you text file looks like:

txtVar=This is all of your writting

This question has been answered about 2.3 million times - about .4 million on this site alone.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 19, 2004, 4:03pm UTC](https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051/3 "2004-02-19T16:03:56Z")

</div>

That didnt work… ☹

I’ve tried looking for an MX 2004 tutorial but cannot…

Do you have any off hand? Thanks again - Your efforts are apreciated on this end!

Dino

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 19, 2004, 5:27pm UTC](https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051/4 "2004-02-19T17:27:35Z")

</div>

This works flawlessly for me in MX04:

```auto
loadText = new LoadVars();
loadText.load("data.txt");
loadText.onLoad = function() {
name.text = this.name;
email.text = this.email;
location.text = this.location;
};

```

It’s cut and pasted from the Kirupa tutorial, except the capital “L” on LoadVars().

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 19, 2004, 6:36pm UTC](https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051/5 "2004-02-19T18:36:27Z")

</div>

It should be:

```auto

lv = new LoadVars();
lv.load("button1.txt");
lv.onLoad = function(ok){
var ref = this;
if(ok){
button1.onRelease = function(){
textField.text = ref.yourVar
}
} else {
trace("File could not be loaded.");
}
}

```

Where yourvar is the variable from the textfile:

yourvar=yourvalue&anothervar=anothervalue&…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 19, 2004, 7:24pm UTC](https://forum.kirupa.com/t/load-txt-files-to-fielda-textbox/102051/6 "2004-02-19T19:24:47Z")

</div>

hehe yup.

By the way V, your footer pic looks like one I took a while back:

[http://www.redscreen.net/photolog/archives/000181.html](http://www.redscreen.net/photolog/archives/000181.html)
