Toggle includeInLayout
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:VBox> <mx:Panel id="p1" title="Panel 1" backgroundColor="#FF0000" /> <mx:Panel id="p2" title="Panel 2" backgroundColor="#00FF00" /> <mx:Panel id="p3" title="Panel 3" backgroundColor="#0000FF" /> </mx:VBox> <mx:HBox> <mx:Button label="Toggle Panel 2 in Layout" click="{p2.includeInLayout=!p2.includeInLayout;}" /> </mx:HBox> </mx:Application>