LineTo not connecting

I have finally worked out most of the issues with my file after many long hours and much help from the forum. Only to have my lines not connect to the “link” button that they should.

They also don’t appear until you click on the movie which is strange since I have them coded to show onLoad I thought.

Can anyone take a look at the code and see if they see what could be causing my line not to connect?

Each node should actually have several lines extending from it based on the XML. XML and FLA are attached.


this.dataArray = new Array();
this.drawNetwork = function(dataSrc){
for (var ID=0;ID < dataSrc.length;ID++){
if (dataSrc[ID] != undefined){
var mc = _root['mc'+ID];
var thisBut = _root['but'+ID];
var prntBut = _root['but'+ dataSrc[ID].prnt];
mc.clear();
mc.lineStyle(2, 0x999999);
mc.moveTo(thisBut._x, thisBut._y);
mc.lineTo(prntBut._x, prntBut._y);
}
}
}
var xmldata = new XML();
var buttons = new Array();
xmldata.ignoreWhite = true;
xmldata.onLoad = function(loaded) {
 var tmpxml;
 if (!loaded || this.status){
  trace ("Not loaded or parse error");
  return; 
 } else {
  tmpxml = this.firstChild.firstChild;
  do {
   buttons.push(Array(tmpxml.attributes.ID, tmpxml.attributes.name, this.getLinks(tmpxml)));
   nodeID =Number(tmpxml.attributes.ID);
   _level0.dataArray[nodeID] = new Object();
	
   var thisNodeID = _level0.dataArray[nodeID];
   name = tmpxml.attributes.name
   // can't create two clips at same depth
   var newBut = _root.attachMovie('butTemp', 'but'+ nodeID, (nodeID*2)+1);
   newBut.but_txt.text = name;
   
   newBut._x = random(600);
   newBut._y = random(500);
   
  } while (tmpxml = tmpxml.nextSibling);
  trace(buttons);
  
 }
  
};
xmldata.getLinks = function(tmpxml){
 tmpxml = tmpxml.firstChild;
 var links = new Array();
 
 do {
  links.push(tmpxml.attributes.to);
  link = Number(tmpxml.attributes.to);
  _level0.dataArray[prnt] = new Object();
   var thisNodeLink = _level0.dataArray[prnt];
  var prntBut = _root['but'+link];
  var mc = _root['mc'+nodeID];
  _root.createEmptyMovieClip( 'mc'+nodeID, nodeID*2);
  
 } while (tmpxml = tmpxml.nextSibling);
 
 return links;
 trace(links);
}
 
xmldata.load("node_link3.xml");
_root.onEnterFrame = function (){
 if (_root.draggingNode) _level0.drawNetwork(_level0.dataArray);
};

XML:


<nodes> 
	  <but name="Node 1" ID="1"> 
	   <link to="2"></link> 
	   <link to="3"></link> 
	   <link to="4"></link> 
	   <link to="5"></link> 
	  </but> 
	  <but name="Node 2" ID="2"> 
	   <link to="3"></link> 
	   <link to="4"></link> 
	   <link to="5"></link> 
	  </but> 
	  <but name="Node 3" ID="3"> 
	   <link to="4"></link> 
	   <link to="5"></link> 
	  </but> 
	  <but name="Node 4" ID="4"> 
	   <link to="5"></link> 
	  </but> 
	  <but name="Node 5" ID="5"> 
	  </but> 
</nodes>