XML: building a dynamic menu

Hello all, I am stuck trying to build a dynamic menu so any help is more than welcome.

The movieClips and and text fields for the menu will be created dynamically in accordance to the XML below. I want to make it flexible so as many number of menu elements as wanted can be inserted just by varying the XML.

The movieclips are going to behave in two ways:

1: The ones that do not have any child elements in their XML representation will load a new page.
Question 1: how do I get in AS3 at once all the elements from an XML file that don’t have any child elements?

2:The ones that have child elements in their XML representation will expand the menu and make their respective child movieClips fade in;
Question 2: how do I get in AS3 at once all the elements from an XML file that have child elements?

Question 3: (my brain is having a hard time, symptoms of having had a great youth :smirk:). Anyhow, I need to dynamically associate each element with its parent element, if any, so that when the menu is expanded the appropriate clips fade in.

This is harder than I though, can’t get to grips with it.

Help would be great, Thanks!

<MENU>

<LEVEL1 NAME = "CV">
</LEVEL1>


<LEVEL1 NAME = "PORTFOLIO" >

                <LEVEL2 NAME = "PHOTOGRAPHY">
                                <LEVEL3 NAME = "TRAVEL"/>
                                <LEVEL3 NAME = "OTHER"/>
                </LEVEL2>
    
                
                <LEVEL2 NAME = "WEB"/>
</LEVEL1>



<LEVEL1 NAME = "CONTACT">

                <LEVEL2 NAME = "OTRO"/>
</LEVEL1>


</MENU>