Check out the Latest Articles:
Centering objects in Spark ( Flex 4 )

So you are desperate looking for that all snippet for centering things? I’ve been looking during hours until I found the solution

In Flex 3 you may use this to center elements on a container:

width=”100%” height=”100%“ horizontalAlign=”center” verticalAlign=”middle“ >

But with Spark things has changed and now you need to write a little more code

width=”100%” height=”100%>

columnAlign=”justifyUsingWidth” rowAlign=”justifyUsingHeight” horizontalAlign=”center” verticalAlign=”middle” requestedColumnCount=”1” requestedRowCount=”1/>

/>

I don’t know if this is the best way to do that, but is the only one I found so far…

I hope this snippet help you!!!!

VN:F [1.9.7_1111]
Rating: 7.5/10 (4 votes cast)
VN:F [1.9.7_1111]
Rating: 0 (from 0 votes)
Centering objects in Spark ( Flex 4 ), 7.5 out of 10 based on 4 ratings

No related posts.



  1. Mrinal Wadhwa (Reply) on Tuesday 18, 2009

    I’m not sure I understood you right but if you want to center an object in a container …

    in Flex 3 you would do …

    In Flex 4 you would do ….

    Group by default follows BasicLayout which is the same as the layout of Canvas in Flex 3

    HorizontalLayout implements a layout similar to HBox in Flex 3

    VA:F [1.9.7_1111]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.7_1111]
    Rating: 0 (from 0 votes)
  2. Xavier Colomer (Reply) on Tuesday 18, 2009

    Sorry, you should be able to see it now, I having some problems with the editor…

    VN:F [1.9.7_1111]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.7_1111]
    Rating: 0 (from 0 votes)
  3. Mrinal Wadhwa (Reply) on Tuesday 18, 2009

    Ok, WordPress ate the … one more try …

    I’m not sure I understood you right but if you want to center an object in a container …

    in Flex 3 you would do …

    <mx:Canvas width=”100%” height=”100%”>
    <mx:Button horizontalCenter=”0″ verticalCenter=”0″/>
    </mx:Canvas>

    In Flex 4 you would do ….

    <s:Group width=”100%” height=”100%”>
    <s:Button horizontalCenter=”0″ verticalCenter=”0″/>
    </s:Group>

    Group by default follows BasicLayout which is the same as the layout of Canvas in Flex 3

    HorizontalLayout implements a layout similar to HBox in Flex 3

    VA:F [1.9.7_1111]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.7_1111]
    Rating: 0 (from 0 votes)
  4. Xavier Colomer (Reply) on Tuesday 18, 2009

    It’s true, HorizontalLayout implements a similar HBox container but you can’t use horizontalAlign. The same occurs with VerticalLayout with verticalAlign.

    VN:F [1.9.7_1111]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.7_1111]
    Rating: 0 (from 0 votes)
  5. Steven Shongrunden (Reply) on Tuesday 18, 2009

    HorizontalLayout/HGroup does now support horizontalAlign in Flex 4. Similarly VerticalLayout/VGroup now supports verticalAlign. This was not available in beta2, but is available in recent nightly builds. See this post for more information: http://flexponential.com/2010/01/20/major-axis-al...

    VA:F [1.9.7_1111]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.7_1111]
    Rating: 0 (from 0 votes)

Spam Protection by WP-SpamFree