Depth issue

Well I’m having a bit of trouble with depths… I think.
I was wondering if anyone could possibly point me in the direction of a good guide/article that concerns depths. It seems my problem is when I run the submenu functions the links don’t work. If it’s another problem and someone could point it out to me that would be great.

var menu_xml:XML = new XML();
menu_xml.onLoad = startXML;
menu_xml.load("menu.xml");
menu_xml.ignoreWhite = true;
startXML();

function startXML() {
    this.createEmptyMovieClip("mainMenu",this.getNextHighestDepth());
    xmlLength = menu_xml.firstChild.childNodes;
    xPos =0;
    yPos = Stage.height - 30;

    for (i=0; i<xmlLength.length; i++) {
        clipName = menu_xml.childNodes[0].childNodes*.attributes.cn;
        clipText = menu_xml.childNodes[0].childNodes*.attributes.n;
        pageLink = menu_xml.childNodes[0].childNodes*.attributes.l;
        textName = menu_xml.childNodes[0].childNodes*.attributes.tn;
        mainMenu.createEmptyMovieClip(clipName,mainMenu.getNextHighestDepth());        
        mainMenu[clipName].moveTo(0,0);
        mainMenu[clipName].beginFill(0xDD00FF);
        mainMenu[clipName].lineTo(100,0);
        mainMenu[clipName].lineTo(100,30);
        mainMenu[clipName].lineTo(0,30);
        mainMenu[clipName].endFill();
        mainMenu[clipName].createTextField(textName,mainMenu.getNextHighestDepth(),0,0,50,20); //instance name, depth, x, y, width, height
        mainMenu[clipName]._x = xPos;
        mainMenu[clipName]._y = yPos;
        mainMenu[clipName][textName].html = true;
        mainMenu[clipName][textName].htmlText = "<a href='"+pageLink+"'>"+clipText+"</a>";
        mainMenu[clipName].onRollOver = function(){
            displaySubMenu(this._name);
        }
        mainMenu[clipName].onRollOut = function(){
            hideSubMenu(this._name);
        }        
        xPos += 150;        
    }
}

function displaySubMenu(mcName) {
    listLength = menu_xml.childNodes[0].childNodes;
    for (var ii = 0; ii<listLength.length; ii++) {
        if (listLength[ii].nodeName == "m" and listLength[ii].attributes.cn == mcName) {
            listLength2 = menu_xml.childNodes[0].childNodes[ii].childNodes;
            tbH = - 15;
            for (var iii = 0; iii<listLength2.length; iii++) {
                bCat = menu_xml.childNodes[0].childNodes[ii].childNodes[iii].attributes.n;                
                fieldName = menu_xml.childNodes[0].childNodes[ii].childNodes[iii].attributes.cn;
                link = menu_xml.childNodes[0].childNodes[ii].childNodes[iii].attributes.l;
                mainMenu[mcName].createTextField(fieldName,15+iii,0,tbH,80,15);
                mainMenu[mcName][fieldName].html = true;
                mainMenu[mcName][fieldName].htmlText = "<a href='"+link+"'>"+bCat+"</a>";
                tbH -= 15;
            }
        }
    }    
}

function hideSubMenu(mcName) {
    listLength = menu_xml.childNodes[0].childNodes;
    for (var ii = 0; ii<listLength.length; ii++) {
        listLength2 = menu_xml.childNodes[0].childNodes[ii].childNodes;
        for (var iii = 0; iii<listLength2.length; iii++) {
            fieldName = menu_xml.childNodes[0].childNodes[ii].childNodes[iii].attributes.cn;
            mainMenu[mcName][fieldName].removeTextField();
        }
    }    
}