Flex创建菜单栏
运行效果请访问:http://tongqiuyan.blog.163.com/blog/static/1955453022011921114130827/
代码如下:
?
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"layout="vertical"verticalAlign="top"fontSize="12"paddingTop="20"><mx:Script><![CDATA[import mx.controls.Alert;import mx.events.MenuEvent;[Bindable][Embed(source="gif-0952.gif")]public var myIcon:Class;private function itemClickHandler(event:MenuEvent):void{if (event.label == "退出"){Alert.show("您单击的是退出按钮");}}]]></mx:Script><mx:Panel width="420" height="350" title="菜单栏" paddingLeft="10" paddingTop="10"><mx:MenuBar id="myMenuBar"labelField="@label"iconField="@icon"itemClick="itemClickHandler(event);"height="30"width="380"><mx:XMLList><menuitem label="文件"><menuitem label="打开..."/><menuitem label="保存" enabled="false" icon="myIcon"/><menuitem label="另存为..." type="check" toggled="true"/><menuitem label="" type="separator"/><menuitem label="发送"><menuitem label="电子邮件页面" type="radio" groupName="one"/><menuitem label="桌面快捷方式" type="radio" groupName="one" toggled="true"/></menuitem><menuitem label="打印"/><menuitem label="退出"/></menuitem><menuitem label="编辑"/><menuitem label="查看"/><menuitem label="工具"/><menuitem label="帮助"/></mx:XMLList></mx:MenuBar></mx:Panel></mx:Application>
?