# Flash XML

**URL:** <https://forum.kirupa.com/t/flash-xml/254785>\
**Category:** flash\
**Created:** [March 15, 2008, 12:59pm UTC](https://forum.kirupa.com/t/flash-xml/254785 "2008-03-15T12:59:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![james182](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@james182](https://forum.kirupa.com/u/james182)\
**Post date:** [March 15, 2008, 12:59pm UTC](https://forum.kirupa.com/t/flash-xml/254785/1 "2008-03-15T12:59:20Z")

</div>

i am trying to have one XML file for my flash movie, in it would be the menu and page info.  
But it doesn’t work.  
XML:

```auto
<?xml version="1.0" encoding="utf-8"?>

<config>

    <navigation>

        <menuItem>

            <linkCat>menu</linkCat>

            <btnName>Home</btnName>

            <btnLink>content/home.swf</btnLink>

        </menuItem>

        <menuItem>

            <linkCat>menu</linkCat>

            <btnName>Services</btnName>

            <btnLink>content/services.swf</btnLink>

        </menuItem>

        <menuItem>

            <linkCat>menu</linkCat>

            <btnName>Manual</btnName>

            <btnLink>content/manual.swf</btnLink>

        </menuItem>

        <menuItem>

            <linkCat>menu</linkCat>

            <btnName>Contact</btnName>

            <btnLink>content/contact.swf</btnLink>

        </menuItem>

    </navigation>

    <sections>

        <clientDetails>

            <client>James</client>

            <projectName>HotJim</projectName>

            <clientManual>content/pdf/test.pdf</clientManual>

        </clientDetails>

        

        <serviceDetails>

            <services>

                <serviceType>electrical</serviceType>

                <description>blablablah.</description>

            </services>

            <services>

                <serviceType>IT</serviceType>

                <description>blablablah.</description>

            </services>

        </serviceDetails>

        

        <companyDetails>

            <address>1</address>

            <phone>2</phone>

            <fax>3</fax>

            <web>4</web>

        </companyDetails>

    </sections>

</config>

```

AS:

```auto
function loadXML(loaded) {
    if (loaded) {
        var xmlMenu = this.firstChild.firstChild;
        menuCat = [];
        btnName = [];
        btnLink = [];
        // Client Details
        var xmlClient = xmlMenu.nextSibling;
        client = [];
        projectName = [];
        clientManual = [];
        
        totalMenu = xmlMenu.childNodes.length;
        for (i=0; i<totalMenu; i++) {
            menuCat* = this.firstChild.firstChild.firstChild.nextSibling.childNodes*.childNodes[0].firstChild.nodeValue;
            btnName* = this.firstChild.nextSibling.childNodes*.childNodes[1].firstChild.nodeValue;
            btnLink* = xmlMenu.childNodes*.childNodes[2].firstChild.nodeValue;
            trace(menuCat*);
            trace(btnName*);
        }
        trace("MENU: "+xmlMenu.firstChild.nextSibling);
        trace("MENU: "+xmlMenu.firstChild.nextSibling.childNodes[0]);
        trace("MENU: "+xmlMenu.firstChild.nextSibling.childNodes[0].firstChild.nodeValue);
        trace("");
        
        totalClient = xmlClient.childNodes.length;
        for (i=0; i<totalClient; i++) {
            client* = xmlClient.childNodes*.childNodes[0].firstChild.nodeValue;
            projectName* = xmlClient.childNodes*.childNodes[1].firstChild.nodeValue;
            clientManual* = xmlClient.childNodes*.childNodes[2].firstChild.nodeValue;
        }
        trace("CLIENT: "+xmlClient);
        trace("CLIENT: "+xmlClient.childNodes[0]);
        trace("CLIENT: "+xmlClient.childNodes[0].firstChild.nodeValue);
        
        //setupList();
    } else {
        content = "file not loaded!";
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("config.xml");

```
