# Why doesn't LoadVars() work?

**URL:** <https://forum.kirupa.com/t/why-doesnt-loadvars-work/38398>\
**Category:** Uncategorized\
**Created:** [December 22, 2003, 1:52pm UTC](https://forum.kirupa.com/t/why-doesnt-loadvars-work/38398 "2003-12-22T13:52:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaFFe](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@JaFFe](https://forum.kirupa.com/u/JaFFe)\
**Post date:** [December 22, 2003, 1:52pm UTC](https://forum.kirupa.com/t/why-doesnt-loadvars-work/38398/1 "2003-12-22T13:52:10Z")

</div>

I have a txt file in the folder “info” containing:  
&load=10

## In the fla file i have this code in the first frame:

folder = “info/”;

infoVars = new LoadVars();  
infoVars.load(folder+“info.txt”);

trace(infoVars.load);

* * *

When i run my movie, infoVars.load returns  
undefined instead of 10.

Can someone help me???

---

<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:** [December 22, 2003, 3:12pm UTC](https://forum.kirupa.com/t/why-doesnt-loadvars-work/38398/2 "2003-12-22T15:12:31Z")

</div>

It should be like this:

Frame 1 in the timeline:  
[AS]  
folder = “info/”;  
infoVars = new LoadVars();  
function loadVars() {  
\_root.infoVars.load(\_root.folder+“info.txt”);  
\_root.infoVars.onLoad = function(success) {  
if (success) {  
//load = bad word, call it loadData or something else instead!  
trace(\_root.infoVars.loadData);  
} else {  
trace(“Error.”);  
}  
};  
}

[/AS]

and on the button or what you want to use as the “trigger”:  
[AS]  
\_root.loadVars(); //if you have other than AS 2.0, it should be loadVars instead i believe.  
[/AS]

I will attach the whole “project”. (made in MX2004 w/ AS 2.0)

---

<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:** [December 22, 2003, 9:46pm UTC](https://forum.kirupa.com/t/why-doesnt-loadvars-work/38398/3 "2003-12-22T21:46:01Z")

</div>

thanx!!

it works now!
