all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

Get the text from a dynamic text box



Re: Get the text from a dynamic text box Travis Newbury
10/31/2006 9:09:42 AM
flash actionscript: [quoted text, click to view]

Assuming you have 25 text boxes called textBox1 - textBox25

for (var i = 1; i <= 25; i++) {
trace(eval("textBox"+i).text);
}
Get the text from a dynamic text box redneon
10/31/2006 5:00:25 PM
I have 25 dynamic text boxes on my form labelled Block1 through Block25. I am
trying to cycle through these text boxes and output the text that they contain
using the code listed below.

The problem is that the output doesn't output the text that's in the text
boxes, it outputs "_level0.Block1" through "_level0.Block25".

How can I get it to output the text that's in the text box?


for (var i = 1; i <= 25; i++) {
var textBox = _root["Block" + i];
var position = textBox.text;
trace(position);
}
Re: Get the text from a dynamic text box TimSymons
10/31/2006 8:19:40 PM
You may have to strong type you var to TextField to get it to work but there is
no need to place the information into a variable like that. The following code
would work too:

for (var i = 1; i <= 25; i++) {
trace(_root["Block" + i].text);
}


Tim
AddThis Social Bookmark Button