Is this possible w/ LoadVars and onLoad?

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.

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

Awesome, kax. Worked perfectly.

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

Thanks for your help.

No problem. :wink:

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