# Major loop problem with XML needs fixing

**URL:** <https://forum.kirupa.com/t/major-loop-problem-with-xml-needs-fixing/120573>\
**Category:** Uncategorized\
**Created:** [August 25, 2004, 2:50pm UTC](https://forum.kirupa.com/t/major-loop-problem-with-xml-needs-fixing/120573 "2004-08-25T14:50:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![markP](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@markP](https://forum.kirupa.com/u/markP)\
**Post date:** [August 25, 2004, 2:50pm UTC](https://forum.kirupa.com/t/major-loop-problem-with-xml-needs-fixing/120573/1 "2004-08-25T14:50:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![markP](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@markP](https://forum.kirupa.com/u/markP)\
**Post date:** [August 25, 2004, 2:56pm UTC](https://forum.kirupa.com/t/major-loop-problem-with-xml-needs-fixing/120573/2 "2004-08-25T14:56:52Z")

</div>

forgot the files… 🙂
