# Is this possible w/ LoadVars and onLoad?

**URL:** <https://forum.kirupa.com/t/is-this-possible-w-loadvars-and-onload/27691>\
**Category:** flash\
**Created:** [August 5, 2003, 5:41pm UTC](https://forum.kirupa.com/t/is-this-possible-w-loadvars-and-onload/27691 "2003-08-05T17:41:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![waterman](https://avatars.discourse-cdn.com/v4/letter/w/b2d939/32.png) [@waterman](https://forum.kirupa.com/u/waterman)\
**Post date:** [August 5, 2003, 5:41pm UTC](https://forum.kirupa.com/t/is-this-possible-w-loadvars-and-onload/27691/1 "2003-08-05T17:41:18Z")

</div>

Greetings! This is my first post, but I’ve been snooping around here for a little while. Thanks, Kirupa, for such a great resource!

\*\*Here’s the situation: \*\*

I’ve got a URL-encoded text file that looks like this:

sw1=on&sw2=off&sw3=on (etc, etc.)

On the stage I have instances of movie clips named sw1, sw2, sw3, etc. Those movie clips have two frames each that are labeled “on” and “off.”

I want to load the text file in and have the movie clips go the appropriate frame based on the variable’s property. I can trace both ‘i’ and ‘this\*’ (‘i’ is a variable in the code below), so I know the variables and properties are there, but I can’t control the movie clips using the line:

[AS]i.gotoAndStop(this\*);[/AS]

Is this possible? Is there a way to accomplish this same goal? I’m new to AS, but I’ve had some experience with other languages. Be gentle. Here’s the code segment for my onLoad function…

[AS]  
myLoadVar = new LoadVars();  
myLoadVar.onLoad = function() {   
for (i in this) {  
if (i != “onLoad”) {  
trace("The variable " + i + " is set to " + this\*);  
i.gotoAndStop(this\*);  
}  
}  
}  
[/AS]

Thanks for your input. I really appreciate it.

---

<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:** [August 5, 2003, 8:14pm UTC](https://forum.kirupa.com/t/is-this-possible-w-loadvars-and-onload/27691/2 "2003-08-05T20:14:40Z")

</div>

[AS]eval(i).gotoAndStop(this\*);[/AS]  
Should do…

---

<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:** [August 5, 2003, 8:53pm UTC](https://forum.kirupa.com/t/is-this-possible-w-loadvars-and-onload/27691/3 "2003-08-05T20:53:58Z")

</div>

Awesome, kax. Worked perfectly.

I think that’ll be one tip to hold on to. 🙂

Thanks for your help.

---

<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:** [August 5, 2003, 9:32pm UTC](https://forum.kirupa.com/t/is-this-possible-w-loadvars-and-onload/27691/4 "2003-08-05T21:32:17Z")

</div>

No problem. 😉

Also check this link: [http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082)
