Event Flex


    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark"
    creationComplete="initApp();">
    
         
        import mx.controls.Alert; 
        private function initApp():void { 
            b1.addEventListener(MouseEvent.CLICK, myEventHandler); 
        } 
        private function myEventHandler(event:Event):void { 
            Alert.show("An event occurred."); 
        }