thanks steven but where in this do i populate my textfield in order to calculate the widths?
-----Original Message----- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Steven Sacks Sent: 26 August 2009 09:53 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields As I described on my forum post, you have to first put your items in an array. var items:Array = [all, of, your, items]; var len:int= items.length; var i:int; Then, you do the following measurements: // the right of the last item minus the left of the first item var availableWidth:Number = items[len - 1].x + items[len -1].width - items[0].x; // the total widths of all the items var totalWidth:Number = 0; i = len; while (i--) { totalWidth += items[i].textWidth; } //Subtract the totalWidth from availableWidth to get the remainingWidth var remainingWidth:Number = availableWidth - totalWidth; // Divide remainingWidthby the number of items var gapWidth:Number = remainingWidth / len; // iterate through your array setting the x positions // of the items based on the previous item's width and the gap. var lastX:Number = 0; for (i= 0; i < len; ++i) { items[i].x = lastX; lastX = items[i].textWidth + gapWidth; } // That's all there is to it. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders