XML variable scope issue

Hey there. I’m not too strong at coding but I know enough to get things done in actionscript. I recently read some of the primers for XML in Flash and can’t completely get it working. The example I chose to work with was the ‘inventors’ xml file which is read into a simple movie with 2 dynamic textboxes which was found here on kirupa. Worked like a champ, nice and simple.

I replicated it in my own project and it worked, but only on the main timeline. Whenever I tried to target a dynamic text box nested inside a movieclip, nothing would come up. At first, the nested dynamic text box was contained in it’s own layer. When that didn’t seem to work, I cited another example on the site (regarding an XML-driven .mp3 player i think…) and tried to attach the dynamic text box from the library to a movieclip at runtime…still wouldn’t work.

I know the XML data is being loaded properly because the trace commands I output were never undefined and held valid data. Any help at all would be much appreciated!

Here’s the xml file :

 
<?xml version="1.0"?>
<inventors>
 <person>
  <name>Thomas Edison</name>
  <comment>Inventor of many things such as the incandescent lightbulb.</comment>
 </person>
 <person>
  <name>Doug Engelbart</name>
  <comment>Invented the mouse at the Stanford Research Institute</comment>
 </person>
</inventors>

and the actionscript (on frame 1 of ‘lensFlare’ movieclip)

 
stop();
var root:MovieClip = this;
 
function loadXML(loaded) { 
if (loaded) { 
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; 
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue; 
trace(_root.inventor);
var Mc:MovieClip = root.attachMovie("txt_mc", "txt_mc1", 1);
Mc.inventor = _root.inventor;
///here's where I think i'm going wrong in some way
Mc.txt_mc.text = Mc.inventor;
trace(Mc.txt_mc.text);
//txt_comment.text = _root.comments; 
} else { 
  trace("file not loaded!"); 
} 
} 
xmlData = new XML(); 
//xmlData.ignoreWhite = true; 
xmlData.onLoad = loadXML; 
xmlData.load("inventors.xml"); 

linkage for the movieClip and the dynamic text box is enabled as well.