import mx.controls.Alert;
import mx.controls.Menu;
import mx.events.MenuEvent;
private function showMenu():void
{
var myMenu:Menu = Menu.createMenu(myButton, myMenuData);
myMenu.labelField="@label";
myMenu.addEventListener("itemClick",handleMenuClick);
myMenu.show();
}
private function handleMenuClick(evt:MenuEvent):void
{
mx.controls.Alert.show(evt.item.@label);
lastEvent.text = "Selection:" + evt.item.@label + ", Position: " + evt.index + " Type:" + evt.item.@openType;
}