# Clearing XML menu to load another

**URL:** <https://forum.kirupa.com/t/clearing-xml-menu-to-load-another/291773>\
**Category:** flash\
**Created:** [July 5, 2009, 7:25am UTC](https://forum.kirupa.com/t/clearing-xml-menu-to-load-another/291773 "2009-07-05T07:25:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BiGg\_RiE](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@BiGg\_RiE](https://forum.kirupa.com/u/BiGg_RiE)\
**Post date:** [July 5, 2009, 7:25am UTC](https://forum.kirupa.com/t/clearing-xml-menu-to-load-another/291773/1 "2009-07-05T07:25:14Z")

</div>

I have a menu that is populated by XML, I’d like to know how I can clear that menu to load another one in it’s place.

I can get the other menu to load but it’s adding itself to the previously generated menu:

so let’s say I have an XML document that has \<menuItem\> nodes that have nodes within them named [this is the default menu]:

bread  
basket  
wheat  
hay

and another XML with the following:

orange  
peach  
lemon  
apple

What I’d like is when i hit a button let’s say “Fruit”  
It Loads:

orange  
peach  
lemon  
apple

and only those.

right now it loads:

bread  
basket  
wheat  
hay  
…and attaches:  
orange  
peach  
lemon  
apple

how can i clear the XML or for loop that created the buttons so that the newly loaded menu from the newly loaded xml is the only menu that is displayed and not tacked on to the existing menu?

Thanks in advance guys!
