Vertical button positioning without x,y coordinates

Hi guys,

I’m trying to layout a navigation in flash that flows vertically down the page so basically something like

Home
About
Contact

etc. each button on a new line. Now at the moment im doing this by setting the y-coordinate of each button in the for loop where i add each button to the stage, so something like:


for(var i=0;i<mainNavList.length;i++){
    var navItem:NavButton = new NavButton(mainNavList*); // This class extends MovieClip
    navItem.y = i*12; 
}

Now this is working perfectly for me, but the problem is I dont want to set it using explicit ‘absolute’ style coordinates (dont want to use Y coords). I just want to be able to add a new button and it to follow underneath the previous one.

Why basically a) because i need each button to expand to show its children, and if it does ill have to go through and re-set all the Y values of the buttons underneath it (which is messy and a real pain).

So is there any object/element i can use that will do this automatically? something that would behave in the same was the CSS property of ‘display:block’ would really.

Thanks.