When I write Flex applications I often encapsulate the user interface in a single container so the main MXML file isn’t muddled with both startup logic and UI components.

This also has the benefit of reducing the layout complexity. Since there’s only a single container to worry about, it can always have 100% height and width.

With absolute positioning, the container is placed at (x=0, y=0). With vertical or horizontal positioning, the vertical and horizontal alignments are set to middle and center, respectively.

Either way you end up with a single container in the center of your application taking up 100% of the width and 100% of the height – no difference, right?

Not quite.

Check out the following two screenshots. The one on the left uses absolute positioning. The one on the right uses vertical positioning.

See the difference?

It turns out that vertical and horizontal positioning result in a rather sizable margin around your container. Setting the vertical and horizontal gaps to zero have no effect.

Absolute positioning results in the appearance you would expect – the container taking up the entire application space.

While it’s not hard to modify the vertical positioning code to produce the same result as absolute positioning, why bother? 🙂