Loading components dynamically

Sorry if the answer has been posted before, I’ve searched but couldn’t find it.

Here’s my problem… I’m attempting dynamically create some icon buttons components from Macromedia’s UI components 2. I’ve managed to load one, but it has the wrong name etc… I need to be able to load as many as the XML file says I need.

Here’s the code I have so far:


 ProgramXML = new XML();
  ProgramXML.load("Data.xml");
  ProgramXML.ignoreWhite = True;
  ProgramXML.onLoad = function(success) {
  	if (success) {
  		Base = ProgramXML.firstchild;
  		// Ignore, its for the tabs at the top
  		_root.Butt0.Title = Base.childnodes[0].attributes.TITLE;
  		_root.Butt1.Title = Base.childnodes[1].attributes.TITLE;
  		_root.Butt2.Title = Base.childnodes[2].attributes.TITLE;
  		_root.Butt3.Title = Base.childnodes[3].attributes.TITLE;
  		_root.Butt4.Title = Base.childnodes[4].attributes.TITLE;
  		_root.Butt5.Title = Base.childnodes[5].attributes.TITLE;
  		// Load Buttons
  		trace(Base.childnodes.length);
  		for (i = 0; i < Base.childnodes.length; i++) {
  			ButtonNm = "Butt"+i;
 			init = {Label: ButtonNm, arrange: right, toggle: false, value: false, background: "ButtonSkin"};
 			_root.attachMovie("FIconButtonSymbol", ButtonNm, i, Init);
  		}
  	} else {
  		trace("Problem:");
  		trace(ProgramXML.status);
  		trace(ProgramXML);
  	}
  };
  

I have the right code for one button, but not for the positioning or creation of multiple buttons…

Can anyone help??

Thank you in advance!