Hi guys,

I have a question for you. I have loaded XML into flash and everything is great.
I have an Associative Array that makes a dynamic menu and everything is great.

What I would like to do is combine the two and have my loaded XML fill up the Array and the dynamic menu.

Here is the XML portion:

Actionscript Code:
//Imports
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;

//Create XMl variable
var teamsXML:XML;
//Create URL Loader
var xmlLoader:URLLoader = new URLLoader();
//Tell the URLLoader named XMlLoader to listen for the xml
//file to finish loading, then run the function xmlLoaded
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
//Tell the XmlLoader to load in a URLRequest with the path to the
//xml file
xmlLoader.load(new URLRequest("assets/teams.xml"));

//This function runs when the xml file is loaded
function xmlLoaded(evt:Event):void
{
    //This tells teamsXML to load in the xml and the new XML
    //tells flash to read the file as HTML
    teamsXML = new XML(xmlLoader.data);
    trace(teamsXML.team.@name);
    trace(teamsXML.team.url);
}

Here is the Associative Array portion:

Actionscript Code:
import flash.display.Sprite;

var menuContainer:Sprite = new Sprite();

var menuItems:Array = new Array();

menuItems.push({item:"Rams", url:"http://www.stlouisrams.com/", order:"4"});
menuItems.push({item:"Lakers", url:"http://www.nba.com/lakers/", order:"3"});
menuItems.push({item:"Yankees", url:"http://www.yankees.com/", order:"2"});
menuItems.push({item:"Devils", url:"http://devils.nhl.com/", order:"1"});
menuItems.sortOn("order");

var buttonCount:int = 0;

for each (var menuProperty in menuItems)
{
    var miItem:MenuItem = new MenuItem();
    miItem.tLabel.text = menuProperty.item;
    miItem.url = menuProperty.url;
    miItem.y = (miItem.height * buttonCount);
    menuContainer.addChild(miItem);
    buttonCount++;
}

addChild(menuContainer);

Here is the XML file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<?processing instructions?>
<!-- My Comments1 -->

<teams>
    <team name = "St.Louis Rams">
    <url>http://www.stlouisrams.com/</url>
    </team>
    <team name = "LA Lakers">
        <url>http://www.nba.com/lakers/</url>
    </team>
    <team name = "NY Yankees">
        <url>http://www.yankees.com/</url>
    </team>
    <team name = "NJ Devils">
        <url>http://devils.nhl.com/</url>
    </team>  
</teams>
Thank you!