<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:VBox>
<mx:Script>
<![CDATA[
import mx.events.MenuEvent;
import mx.controls.Alert;
private function handleMenuClick(e:MenuEvent):void
{
switch (e.label)
{
case "menu11":
Alert.show("menu11");
break;
case "menu12":
Alert.show("menu12");
break;
case "menu21":
Alert("menu21");
break;
case "menu22":
Alert.show("menu22");
break;
}
}
]]>
</mx:Script>
<mx:VBox x="0"
y="0"
width="100%"
height="100%"
verticalGap="0">
<mx:HBox width="100%"
height="50"
id="title_box">
<mx:Label text="menu test"
fontSize="30"/>
</mx:HBox>
<mx:HBox width="100%"
height="30"
id="meun_box">
<mx:MenuBar x="0"
y="0"
width="100%"
height="100%"
itemClick="handleMenuClick(event)"
labelField="@label"
fontStyle="normal"
menuStyleName="#0267b5">
<mx:XMLList id="menu_test">
<menuitem label="menu1"
fontSize="15">
<menuitem label="menu11"
fontSize="15"/>
<menuitem label="menu12"
fontSize="15"/>
</menuitem>
<menuitem label="menu2"
fontSize="15">
<menuitem label="menu21"
fontSize="15"/>
<menuitem label="menu22"
fontSize="15"/>
</menuitem>
</mx:XMLList>
</mx:MenuBar>
</mx:HBox>
</mx:VBox>
</mx:VBox>
</mx:Application>
flex meun 使用
最新推荐文章于 2024-02-21 16:22:56 发布