<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.events.*;
import mx.controls.*;
//事件函数,弹出提示窗口
public function itemClickHandler(event:MenuEvent):void {
Alert.show("菜单标签: " + event.label);
}
]]>
</mx:Script>
<!-- 菜单数据源 -->
<mx:XMLList id="treeDP">
<node label="菜单A"/>
<node label="菜单B">
<node label="菜单B-1" data="6"/>
<node label="菜单B-2"/>
</node>
<node label="菜单C"/>
</mx:XMLList>
<mx:Panel title="弹出菜单按钮控件示例" height="50%" width="50%"
paddingTop="10" paddingLeft="10" paddingRight="10">
<mx:PopUpMenuButton id="popbnt"
dataProvider="{treeDP}"
labelField="@label"
itemClick="itemClickHandler(event);"/>
</mx:Panel>
</mx:Application>