Attach event to a button
In flex there are two ways to attach event to a button control.
First way.
In the button declaration you can specify the function name on the event name.
Second way
You can programatically attach a function to the buttons click event. See example below.
//Attach function to the buttons click event.
btnAddItem.addEventListener(MouseEvent.CLICK,ShowAddItemWindow);
//Declare the function and implement it.
private function ShowAddItemWindow(evt:MouseEvent):void
{
Alert.show("hello world");
}






