Major loop problem with XML needs fixing

Attached is the FLA made in MX 2004 pro and the XML…
What I’m trying to do is duplicate some main button movieClips for each <dept> node. When pressed these main buttons then show a second set of buttons for as many <menu> nodes there are. In the actionScript the displayMainButtons function is used to loop through the XML and display the Main buttons. With the other 2 “display” functions (displayFirstButton and displaySecondButton) I’m displaying another button for each <menu> node. These too works just fine, but the problem with writing it this way is that I have to write another “display” function for as many <dept> nodes there are. I’d like this to be written so it loops through it in one function so I can add as many <dept> nodes with as many <menu> nodes as I’d like without going back into the AS code to add more “display” functions. And as you can see, I had to do the same to delete the buttons. Any idea how to get this done the right way?

Thanks

forgot the files… :slight_smile: