PDA

View Full Version : How to Convert String to Varialbe



atomek
January 9th, 2003, 01:52 PM
I need to build a large table with variables in it (ie xNum0,xNum1,xNum2, etc.). I would rather use a loop to do this than hand code the variables. Is it possible to convert a string, such as " xNum" + i to a variable?

Your help is much appreciated.

senocular
January 9th, 2003, 02:01 PM
i = 1
this["xNum" + i] = 5;

trace(xNum1); // traces 5

also see http://www.kirupaforum.com/showthread.php?s=&threadid=12082

atomek
January 9th, 2003, 03:37 PM
Thank you.