Hi Newgrounds, need some help here.
I was wondering if its possible to substitute a variable with another variable’s name instead of its actual value. Not sure what I mean? Let me explain.
I have a variable named “pLeg” thats equal to the value of 1.
I have blank variable named “itemVar”.
Now, I want “itemVar” to equal to “pLeg”, but not of its value, but of its name string.
The reason is because I need “itemVar” to substitute multiple variables in a main timeline code.
For example:
if(_root.itemVar !== 1) {
//do something
}
“itemVar” can be any variable, like pTorso, or pWeapon or anything. Which is why I can’t have it equal to the variables actual value, because then the timeline code would turn out to be:
if( 1 == 1) {
//1 being itemVar
}
Any thoughts?
PS: I’ve tried add quotations like _root.itemVar = “pLeg” but Flash will not read it as a variable.
-Jephz