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.8.1_1037]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.1_1037]
Rating: 0 (from 0 votes)
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Technorati
  • Twitter

No related posts.


This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.


  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

    UN:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.1_1037]
    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…

    UA:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.1_1037]
    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

    UN:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.1_1037]
    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.

    UA:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.1_1037]
    Rating: 0 (from 0 votes)

Spam Protection by WP-SpamFree