# loadVars()

**URL:** <https://forum.kirupa.com/t/loadvars/6997>\
**Category:** flash\
**Created:** [October 21, 2002, 8:05pm UTC](https://forum.kirupa.com/t/loadvars/6997 "2002-10-21T20:05:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![webEuphoria](https://avatars.discourse-cdn.com/v4/letter/w/b77776/32.png) [@webEuphoria](https://forum.kirupa.com/u/webEuphoria)\
**Post date:** [October 21, 2002, 8:05pm UTC](https://forum.kirupa.com/t/loadvars/6997/1 "2002-10-21T20:05:30Z")

</div>

I have a textfile with the text “count=3” in it(without the “”).

I then have the code:

puppycount = new LoadVars();  
puppycount.load(“puppycount.txt”)

inside a movieClip called “slider”, which is inside a movieclip called “puppies”. Also inside “slider” I have a dynamic textfield with variable set as “count”(without the “”).

Why won’t this work???

---

<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:** [October 21, 2002, 8:28pm UTC](https://forum.kirupa.com/t/loadvars/6997/2 "2002-10-21T20:28:19Z")

</div>

You have to store the value in a variable. Something like that:

```auto
puppycount = new LoadVars();
puppycount.onLoad=function(){
  count=this.count;
}
puppycount.load("puppycount.txt");

```

Then you’ll have a variable count holding the value 3.

pom :asian:

---

<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:** [October 21, 2002, 8:45pm UTC](https://forum.kirupa.com/t/loadvars/6997/3 "2002-10-21T20:45:01Z")

</div>

Thank you that works!

Do I have to convert that 3 to a number now? Because I tried this

puppycount = new LoadVars();  
puppycount.load(“puppycount.txt”);  
puppycount.onLoad=function(){  
count=this.count;  
count=Number(count);  
}

and instead of the textfield showing “3” it showed “NaN”

---

<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:** [October 21, 2002, 9:36pm UTC](https://forum.kirupa.com/t/loadvars/6997/4 "2002-10-21T21:36:46Z")

</div>

No, it’s fine. Flash isn’t a strongly-typed language, you don’t need to bother. And if you really have a problem, well, I’m sure there’s a way out 🙂

pom :cowboy:
