# Dynamic textbox \> setting text \> XML value

**URL:** https://forum.kirupa.com/t/dynamic-textbox-setting-text-xml-value/171580
**Category:** Uncategorized
**Created:** [December 6, 2005, 6:21pm UTC](https://forum.kirupa.com/t/dynamic-textbox-setting-text-xml-value/171580 "2005-12-06T18:21:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pete\_zahut](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pete\_zahut](https://forum.kirupa.com/u/pete_zahut)
#### Post date: [December 6, 2005, 6:21pm UTC](https://forum.kirupa.com/t/dynamic-textbox-setting-text-xml-value/171580/1 "2005-12-06T18:21:50Z")

</div>

Why won’t this work?

```auto
var galleries = this.firstChild.childNodes;
for(var i=0;i<galleries.length;i++) {
	var gallery = galleries*;
	trace(gallery.attributes.name);
	duplicateMovieClip(_root.btn_dummy,"btn_" + i,i);
	_root["btn_" + i]._x = 50;
	_root["btn_" + i]._y = 50 + i*22;
	_root["btn_" + i].btnText.text = gallery.attributes.name;
	trace("++++ " + _root["btn_" + i].btnText.text);
}

```

So I duplicate a button I made on the root called btn\_dummy and the duplication works just fine but only the text doesn’t show.  
My first trace shows my XML child nodes, but the second trace just shows “++++ undefined”.

Isn’t this the right way to do it?  
**_root["btn_" + i].btnText.text = gallery.attributes.name;**

Any one?

Thanks!
