Addressing dynamically created text fields?
I have a movie where I open an XML file, get the data, then I want to create a text field for each item under a particular node and set the text property to the "name" value for that node. What I can't figure out is how to properly address the textfield by name? I'm using a for...loop to create all of the text fields, so the names are "txt"+i - so how do I address the text field to set the value of it's text? Here's my code - please help!
(dta is the data loaded from the XML file as an object, bundle is a node, or a property of the object dta)
var max:Number = dta.bundle.length;
for (var i = 0; i < max; i++) {
this.createTextField("cat"+i,_root.depth++,100,100 ,200,15);
_root.cat[i].text = [dta.bundle[i].bname];
trace(_root.cat[i].name);
}
}
Every time I run this I just get "undefined" for each text field...
Thanks for the help!
Eddie
|