XML driven menu spacing in flash isn't working, can anyone help? Driving me mad! Tha

Hi, This is driving me potty and I can’t work it out! I was wondering if anyone has done this before.

In summary, I have an XML document that I am loading into flash to compose a menu dynamically.

Here is what it looks like so far: http://ian.greensplash.com/issue.jpg - very early stages!

So I have a for loop getting the content out of my XML, then populating 2 dynamic text boxes, the title, eg: “module X” and description, eg:: “Lorem ipsum”

So the looping is fine.

What I can’t work out is how to space the objects on the stage evenly because the description is different, thus different heights.

I can space them with a set number for ._y, but I cant work out how to space them nicely. Notice the bigger gap on my link above. The issue is if there is a long description, then the menu items will overlap,

This is my AS. (2.0) (excuse the $'s, habit from using php, but stands out more to me in my AS.)




            $objMainMenuData=$myXML.firstChild.childNodes; //array of first nodes
            

            for (i=0;i<$objMainMenuData.length;i++)
            {
                //trace(objMainMenuData*.attributes.text); // loop the test attributes
                $mainMenuBut=_root.attachMovie('mainMenuModuleBut', 'but'+i,_root.getNextHighestDepth());

                trace("my loop is at i :" + i)
                $mainMenuBut._x=40;
                
                // update the text on button
                trace("module name: " + $objMainMenuData*.firstChild.firstChild.nodeValue);
                $mainMenuBut.dtxtModuleName.text=$objMainMenuData*.firstChild.firstChild.nodeValue;
                
                //get the module's summary
                $mainMenuBut.$moduleSummary=$objMainMenuData*.firstChild.nextSibling.nextSibling.firstChild.nodeValue;
                trace("the summary description is: " + $mainMenuBut.$moduleSummary);
                $mainMenuBut.dtxtModuleDescription.text=$objMainMenuData*.firstChild.nextSibling.nextSibling.firstChild.nodeValue;
                
                // spacing
                $mainMenuBut.dtxtModuleDescription.autoSize = "center";
                trace("height of description is: " + $mainMenuBut.dtxtModuleDescription._height);
                $mainMenuBut.mainMenuModuleButBG._height=($mainMenuBut.dtxtModuleDescription._height)+45;
                $ModuleDescriptionHeight_dtxt=$mainMenuBut.dtxtModuleDescription._height;
                //space the items nicely.
                trace("trying current height: "+$mainMenuBut.dtxtModuleDescription._height);
                $mainMenuBut._y=(i*115)+125;  //space them out, but start with a 125 indent;


                //get the right link for the button
                $mainMenuBut.$moduleButtonLink=$objMainMenuData*.firstChild.nextSibling.firstChild.nodeValue;
                trace("the module button link is: " + $mainMenuBut.$moduleButtonLink);
                
                $mainMenuBut.onRelease=function()
                {
                    $newModuleButtonLink=this.$moduleButtonLink
                    trace("ok the still is : "+ $newModuleButtonLink);
                }
                
                    $mainMenuBut.onRollOver=function()
                    {
                        this.mainMenuModuleButBG._alpha=80;
                    }
                    
                    $mainMenuBut.onRollOut=function()
                    {
                        this.mainMenuModuleButBG._alpha=100;
                    }



Any help will be extremely welcomed!

Thanks in advance!

Ian