Event Flex



    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
    creationComplete="initApp(event)">
    
        
    

     
        private function initApp(e:Event):void { 
            b2.addEventListener("click",myClickHandler); 
            b3.addEventListener("click",myClickHandler); 
        } 
        private function destroyButtons(e:Event):void { 
            b2.removeEventListener("click",myClickHandler); 
            b3.removeEventListener("click",myClickHandler); 
            myVGroup.removeAllElements(); 
        } 
        private function myClickHandler(e:Event):void { 
            // Do something here. 
        }