A short while ago, I was bemoaning the fact that the Flex HorizontalList control only ever left aligned its items. Over the weekend, I thought about this again and realised that by overriding the measure() method, I could set the width of the horizontal list based on its contents and allow its container to center it.

Here's a demo of my AlignedHorizontalLost control. It only contains two overridden methods - updateDisplayList() explicitly invokes measure() and the overridden measure() resizes the control using the measureWidthOfItems() function.

If you open the demo, you can add and remove items. The top list is the regular left aligned HorizontalList and the bottom is my extended version.

The complete source is available here.
0

Add a comment

About Me
About Me
Labels
Labels
Blog Archive
Loading