Hi Ben,

The reason is in any Container subclass IE Box, Canavs etc, the Layout class
actually calls setActualSize() on the button child.

Since you are using a custom component that does not have or implement a
Layout class, you must call,

button.setActualSize(button.getExplicitOrMeasuredWidth(),
button.getExplicitOrMeasuredHeight());

The containers Layout class essentially does the above with more space
checking etc.

Peace, Mike

PS All components that are not children of a Layout contianer must be sized
a Button is no exception.

On 9/10/07, ben.clinkinbeard <[EMAIL PROTECTED]> wrote:
>
>   Why is it that when I create a Button as a child of a custom component
> I have to give it a width and a height, whereas creating one in
> straight MXML or AS in an application auto sizes it to fit the label?
>
> Thanks,
> Ben
>
>  
>



-- 
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to