Flex: when hiding components in flex

actionscript-3apache-flex

When I set a component to visible=false the component hides, but how do I get it to take no space (get the container it belongs to to resize??)

<mx:HBox width="100%" height="100%">
...
</mx:HBox>

<mx:HBox width="100%" id="boxAddComment" visible="false" >
    <mx:TextArea id="txtComment"/>
    <mx:Button label="Spara" click="addComment();"/>
</mx:HBox>

When boxAddComment is visible=false I want the first HBox to take 100% height.

Best Answer

use the includeInLayout property. e.g.


<mx:HBox width="100%" height="100%">
...
</mx:HBox>

<mx:HBox width="100%" id="boxAddComment" visible="false" includeInLayout="false" >
    <mx:TextArea id="txtComment"/>
    <mx:Button label="Spara" click="addComment();"/>
</mx:HBox>


Related Topic