Assuming you have set variableRowHeight="true", the List will ask the VBox for 
its explicitHeight then its measuredHeight.  Make sure you haven't set 
explicitHeight or height on the VBox tag.  Then the VBox's measurements should 
work correctly unless you have mx:Text or some other flow-based control in 
there.  If you do, you'll need to set a width for the flow-based controls based 
on the VBox's explicitWidth at measure() time.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of lambovell
Sent: Monday, June 22, 2009 3:59 PM
To: [email protected]
Subject: [flexcoders] Re: Set the height of a custom itemRenderer to its 
children





Thanks for the response, droponrcll.

Actually, if I just had the VBox only that would have been fine, but my VBox is 
actually an itemRenderer for a List control. The List control is automatically 
scaling the width and height of the VBox to 100% of the List controls' row.

Any idea how to get around this? Thanks.

--- In [email protected]<mailto:flexcoders%40yahoogroups.com>, "Amy" 
<amyblankens...@...> wrote:
>
> --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, 
> "lambovell" <lambovell@> wrote:
> >
> > The class below is being used as a custom itemRenderer, and I want to set 
> > the height of the VBox to that of its contents (children).
> >
> > public class MyDynamicLayout extends VBox
> > {
> > // .. code removed for brevity
> >
> > override protected function measure():void
> > {
> > super.measure();
> > // measuredHeight = height = ?;// I want to calculate the height of all the 
> > children and set the height of this VBox to that height of all the children 
> > combined.
> > }
> > }
>
> I think that the default measure method of VBox makes it just big enough for 
> its children + all padding and vertical gaps. So just leave off width and 
> height, and you should have it.
>

Reply via email to