# Path to LoadVars()

**URL:** https://forum.kirupa.com/t/path-to-loadvars/24510
**Category:** Uncategorized
**Created:** [July 1, 2003, 5:54pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510 "2003-07-01T17:54:52Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Baggio](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@Baggio](https://forum.kirupa.com/u/Baggio)
#### Post date: [July 1, 2003, 5:54pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/1 "2003-07-01T17:54:52Z")

</div>

Hi,

In the root of my movie i call LoadVars() with instance **MyVars** and load variables from a text file… One of the variables i load is **total**

Now if i have a movie clip with instance say… **MyClip** and in the first frame of this timeline I have

```php

for (i=1; i<=Number(_root.MyVars.total).; ++i) {

//blah blah blah....

}

```

would pthat be a valid method of using the variable total from the loaded text file?

Because i have tried this and the loop doesn’t seem to 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: [July 1, 2003, 6:59pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/2 "2003-07-01T18:59:32Z")

</div>

i see a typo! 😛

```auto
for (i=1; i<=Number(_root.MyVars.total); ++i) {
// blah blah blah....
}

```

you could also try using \_parent instead of \_root.

and most important, make sure that the TXT file has been fully loaded before the code is executed. 😉

---

<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: [July 1, 2003, 7:10pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/3 "2003-07-01T19:10:18Z")

</div>

Ok thanks…

I didn’t encorporate the typo in my code so i suspect it’s the mvie stopping before fully loading the variables…

I’ll try adding a condition statement and let you know

Thanks 😉

---

<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: [July 1, 2003, 7:20pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/4 "2003-07-01T19:20:15Z")

</div>

Hmm I still can’t get it to work :\*( :-/

I added the onload event so that the movie only stops when the file is loaded (and when i check in the debugger they seem to have) but the MC doesn’t use the variable total so my loop doesn’t do anything and so therefore no links are listed on the nav bar…

any ideas?

---

<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: [July 1, 2003, 7:24pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/5 "2003-07-01T19:24:46Z")

</div>

well at the moment there is only like 1 line of text in the file and the dbugger is listing the variables in the file… it’s just accessing them from the movie clip that seems to be the problem. And the rest of the movie doesn’t work because of this :-/

---

<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: [July 1, 2003, 7:44pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/6 "2003-07-01T19:44:42Z")

</div>

sorry… i got to go. :-\

it’s not totally fixed, but at least it should get you in the right direction (or so i hope). 🙂

---

<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: [July 1, 2003, 7:46pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/7 "2003-07-01T19:46:05Z")

</div>

Thanks for your help and ultra fast replies 🙂

I’ll check it out Thanks again

---

<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: [July 1, 2003, 7:59pm UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/8 "2003-07-01T19:59:56Z")

</div>

thanks a lot! I managed to get it to work just how i wanted… This problem has been bugging me for the past few days…

Thanks! 😃

---

<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: [July 2, 2003, 3:00am UTC](https://forum.kirupa.com/t/path-to-loadvars/24510/9 "2003-07-02T03:00:00Z")

</div>

you’re welcome. =)

glad you worked it out!! 😛
