Parents size their children in Flex.  You have to call setActualSize on
your children.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of krakowskyb
Sent: Tuesday, July 01, 2008 7:44 AM
To: [email protected]
Subject: [flexcoders] Sizing Components Inside Custom UIComponents

 

I'm pretty new to Flex. I've created some custom components by
extending UIComponent. I've implemented createChildren,
commitProperties, measure, and updateDisplayList. I can resize the
custom UIComponents using any number of methods:
constraints, CSS, etc. They resize no problem. But if I try to size
a child of that custom component, no width or height is assigned,
unless I use an explicit setActualSize.

For example:
My custom component (Content) has been added to a canvas. The
component is sized using width and height properties:

var content:Content = new Content;
content.width = 800;
content.height = 800;
addChild(content);

In content, in createChildren, I create an instance of the Image
component.

var container:Image = new Image;
container.scaleContent = false;
addChild(container);

I try to do this:
container.percentWidth = 100;
container.percentHeight = 100;

But nothing.

I can only seem to resize this inside updateDisplayList like so:
container.setActualSize(unscaledWidth, unscaledHeight);

Thanks,
Brandon



 

Reply via email to