Parents size their children in Flex.  We recommend using
setActualSize(button.getExplicitOrMeasuredWidth(),
button.getExplicitOrMeasuredHeight()) instead of setting width/height
because it doesn't lock in the size of your children's measurements.
There was a posting on this earlier this week.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Sean Clark Hess
Sent: Friday, July 04, 2008 12:17 PM
To: [email protected]
Subject: [flexcoders] Default size in custom UIComponents

 

I don't have a lot of experience making custom UI Components, but there
is one thing I've noticed several times that doesn't make any sense. 

When you add new subcomponents by overriding createChildren, they don't
seem to show up at all unless you explicitly set the width and height.
For example... 

var button:Button = new Button();

button.width = 20; // if you don't set these, it doesn't show up
button.height = 20;

addChild(button);

It seems like a lot of the time you would want the button to be just as
big as it's going to be, without setting it's width and height.  I'm
sure there's a way to do this.  What am I missing?  Please note that I
most recently noticed this on a button that was skinned. 

~sean 

 

Reply via email to