use removeChild() method to remove a control from a container
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> public function removeButton():void { myHBox.removeChild(myButton); } </mx:Script> <mx:HBox id="myHBox"> <mx:Button id="myButton" label="Remove Me" click="removeButton();" /> </mx:HBox> </mx:Application>