Unloading components added on the fly!

Ok, quite complicated, but I’ll explain:

I’m creating a cool little toolbar program using Flash MX, which loads up an XML file and creates buttons for each of the little tabs that are clicked on. The problem I have is that I load up the buttons, which are Flash UI Icon buttons components, really easily, but I can’t seem to sucessfully unload them

Can anyone help?

Heres the code for the loading:


  ProgramXML = new XML();
  ProgramXML.load("Data.xml");
  ProgramXML.ignoreWhite = True;
  ProgramXML.onLoad = function(success) {
  	if (success) {
  		Base = ProgramXML.firstchild;
  		_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;
  		// 
  		_root.ButtonArray = [];
  		// Load Buttons
  		for (i = 0; i < Base.childnodes[0].childnodes.length; i++) {
  		    ButtonLbl = Base.childnodes[0].childnodes*.attributes.TITLE;
  			ButtonNm = "ButtD"+i;
 			init = {Label: ButtonLbl, arrange: right, toggle: false, value: false, background: "ButtonSkin", _x: i * 97};
  		    _root.LoadClip.attachMovie("FIconButtonSymbol", ButtonNm, i, Init);
  			BAL = _root.ButtonArray.length;
  			_root.ButtonArray[BAL] = "_root.LoadClip."+ButtonNm;
  			trace(_root.ButtonArray);
  		}
  		// 
  		// 
  		// Button 1 function
  		_root.Butt0.Butt.onRelease = function() {
  			trace("lENGTH: "+Base.childnodes[0].childnodes.length);
  			Erase();
 			for (i = 0; i < Base.childnodes[0].childnodes.length; i++) {
 			 ButtonLbl = Base.childnodes[0].childnodes*.attributes.TITLE;
  				trace("ButLbl: "+ButtonLbl);
  				ButtonNm = "ButtD"+i;
  				trace("BytNum: "+ButtonNm);
 			 init = {Label: ButtonLbl, arrange: right, toggle: false, value: false, background: "ButtonSkin", _x: i * 97};
 			 _root.LoadClip.attachMovie("FIconButtonSymbol", ButtonNm, i, Init);
  			}
  		};
  	} else {
  		trace("Problem:");
  		trace(ProgramXML.status);
  		trace(ProgramXML);
  	}
  };
  

If you need the source, just ask!

Thankyou