PDA

View Full Version : Addressing a textfield



oscar alexander
May 13th, 2003, 06:28 AM
I have six textfields inside a clip, named digit_1 to digit_6.

The path to the first textfield would be:


_root.mcContainer.digit_1;

How can I dynamically address these fields if I only know the number (ie. 1 to 6)? I've tried this:


eval("_root.mcContainer.digit_" + number) = "value";

But to no avail. Please help...

JuXtA
May 13th, 2003, 07:58 AM
I think it is the other brackets:
eval["_root.mcContainer.digit_" + number] = "value";

oscar alexander
May 13th, 2003, 08:07 AM
Nope. But I found another way to get it right... Instead of using the textfield as a variable, I gave it an instancename and addressed that, like this:



eval("_root.mcContainer.digit_" + number).text = "value";