tags:

views:

113

answers:

1

Hi Everyone!

I am using Flex 4 Spark Components for this one.

I have a custom component that is larger than a certain container, and I need it to be centered in that container. Best using only MXML, styles and properties

This does not work as expected:

<s:BorderContainer x="300" y="300" width="200" height="200">
   <s:Button label="Not centered" horizontalCenter="0" verticalCenter="0" width="300" height="250"/>
</s:BorderContainer>

Thanks!

A: 

Got it.

I noticed that using the whole Application as the Container in the example, the Component would center itself even when larger than the Stage. I cannot use another Application, so I used the next inherited class: SkinnableContainer, instead of BorderContainer, in the above example. It works properly

Liviu