Home > Spark Layouts > VerticalAlign for VGroup and HorizontalAlign for HGroup

VerticalAlign for VGroup and HorizontalAlign for HGroup

January 24th, 2010 Leave a comment Go to comments

majoraxisalignment Recently I checked in the major axis alignment update to VGroup, HGroup, VerticalLayout, HorizontalLayout. It brings parity to the Flex 4 Spark layouts relative to the MX containers HBox and VBox that are well known from previous versions of Flex (and have had those alignment options for long time now).

Now VGroup and VerticalLayout have a “verticalAlign” property with the three supported values of “top“, “middle“, “bottom“. Accordingly HGroup and HorizontalLayout get a “horizontalAlign” property with the supported values of “left“, “center” and “right“. The alignment modes work for the layouts with and without virtualization enabled.
An important difference to note is that when “clipAndEnableScrolling” is set to “true” and the containers are scrolling (the content is bigger than the container), the Spark layouts ensure that the entire content can be scrolled in view by internally reverting to the “top“/”left” alignment respectively.

When playing with the attached sample, you’ll notice difference between the clipping and the non-clipping containers when scrolling is in effect (drag the slider left to force smaller height for the containers).

The sample was compiled with SDK version 4.0.0.13553, source: MajorAxisAlignment.mxml

  1. January 25th, 2010 at 01:19 | #1

    Nice, this was really needed to avoid have to use an extra Group that implement a layout on the other axis.

    Any reason why “justify” and “contentJustify” weren’t also implemented?

    i.e. on a VerticalLayout, “justify” would make all children the same height as the container, or “contentJustify” all children would be made the height of the largest child.

    I currently don’t see any errors if these unsupported values are set via AS (silently defaults back to “top” or “left”. Has this now changed and errors been added?

    • Evtim
      January 26th, 2010 at 00:20 | #2

      Hi Tink,

      Thanks for the comment. We didn’t implement “justify” or “contentJustify” as for example in a VerticalLayout with such verticalAlign settings, all of the elements will be as tall as the layout container. In that case the elements should be either stacked on top of each other (and the layout would no longer make sense to be called vertical) or arranged vertically (but then they won’t really be justified vertically).
      Having said that, I probably don’t understand your particular use case. Perhaps setting 100% height on all of the elements and using a BasicLayout instead is what you have in mind?

      Thanks,
      -Evtim

  2. February 23rd, 2010 at 10:12 | #3

    Hey Evtim,

    sorry for off-topic, can you contact me on my email (filled up, when submitting this comment). I really need to discuss with you bug http://bugs.adobe.com/jira/browse/SDK-25605 (you’ve created yesterday).

    Thanks in advance

  3. August 21st, 2017 at 05:02 | #4

    I see you don’t monetize your page, don’t waste your traffic, you can earn extra cash every month
    because you’ve got high quality content. If you want to know how to
    make extra money, search for: best adsense alternative Wrastain’s tools

  1. September 6th, 2019 at 06:35 | #1