Flex基础知识点。
 
MenuBar
labelField=@property。 使用@获取属性值。
<mx:Script>
    <![CDATA[
      import mx.controls.Alert;
      import mx.events.MenuEvent;
      public function menuHandle(event:MenuEvent):void
      {
        Alert.show(event.item.@label);
      }
    ]]>
  </mx:Script>
    
  <mx:MenuBar id="mb" fontSize="12" labelField="@label" x="429" y="94" itemClick="menuHandle(event)">
    <mx:XMLList id="dataList" xmlns="">
        
      <meunitem label="JAVA">
        <menuitem label="JDBC" />
        
      </meunitem>
        
      <meunitem label=".NET">
        <menuitem label="WINFORM" />
      </meunitem>
        
      <meunitem label="设计">
        <menuitem label="photoshop" />
      </meunitem>
        
    </mx:XMLList>
  </mx:MenuBar>
 
 
对于菜单(MenuBar),统一推荐使用itemClick作为事件进行触发。
通过event.item.@标签名称 的方式来获得用户所选择的值
 
使用{变量名}可以拿到该组件对象。
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initCollection()">
    
  <mx:Script>
    <![CDATA[
      import mx.collections.XMLListCollection;
      import mx.controls.Alert;
      import mx.events.MenuEvent;
        
      // 导入类
      import mx.collections.ArrayCollection;
        
      // 全局变量
      public var menuBarCollection:XMLListCollection;
        
      // 私有变量
      private var menuBarXML:XMLList =
        
      // 这里,使用<>来标识数据    
      <>
        <mx:XMLList id="dataList" xmlns="">
        
        <meunitem label="JAVA">
          <menuitem label="JDBC" data="testJDBC" />
            
        </meunitem>
        
        <meunitem label=".NET">
          <menuitem label="WINFORM" />
        </meunitem>
        
        <meunitem label="设计">
          <menuitem label="photoshop" />
        </meunitem>
        
        </mx:XMLList>
      </>
        
        
      public function initCollection():void
      {
        // 创建集合对象,并注入到menuBarCollection中。
        menuBarCollection = new XMLListCollection(menuBarXML);
      }
        
        
      public function menuHandle(event:MenuEvent):void
      {
        Alert.show(event.item.@label);
        Alert.show(event.item.@data);
      }
    ]]>
  </mx:Script>
    
  <mx:MenuBar id="mb" fontSize="12" labelField="@label" x="429" y="94" dataProvider="{menuBarCollection}" itemClick="menuHandle(event)">
    
  </mx:MenuBar>
    
</mx:Application>
 
弹出式菜单:popUpMenu
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

  <!-- 自定义css样式,样式属性参考帮助手册中的属性说明-->
  <mx:Style>
    Alert{
      title-style-name:"alertTitle";    /* 引用属性 */
      message-style-name:"alertMessage";
      button-style-name:"alertButton";
    }
    .alertTitle {
      fontSize:12;
      fontColor:#FFFFFF;
    }
    
    .alertMessage {
      fontSize:14;
      fontColor:#FFFFFF;
    }
    
    .alertButton {
      fontSize:12;
      fontColor:#FFFFFF;
    }
  </mx:Style>
    
  <mx:Script>
    <![CDATA[
      import mx.controls.Alert;
      import mx.events.MenuEvent;
      public function getValue(event:MenuEvent):void {
        Alert.show(event.item.@label , "提示信息");
      }
    ]]>
  </mx:Script>
    
  <mx:XMLList id="pop_data" xmlns="">
    <editItem label="中文" />
    <editItem label="英文" />
    <editItem label="法文" />        
  </mx:XMLList>
    
  <mx:PopUpMenuButton id="pu2" dataProvider="{pop_data}" labelField="@label" fontSize="12" itemClick="getValue(event)"/>
    
</mx:Application>