主程序
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="init()"> <fx:Script> <![CDATA[ import events.ContentEvent; import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.controls.Menu; [Bindable] [Embed(source="assets/folder.png")] public var folderIcon:Class; [Bindable] [Embed(source="assets/edit.png")] public var editIcon:Class; [Bindable] [Embed(source="assets/plus.png")] public var plusIcon:Class; [Bindable] [Embed(source="assets/opened.png")] public var openedIcon:Class; [Bindable] [Embed(source="assets/save.png")] public var saveIcon:Class; [Bindable] [Embed(source="assets/close.png")] public var closeIcon:Class; [Bindable] [Embed(source="assets/cut.png")] public var cutIcon:Class; [Bindable] [Embed(source="assets/undo.png")] public var undoIcon:Class; [Bindable] [Embed(source="assets/copy.png")] public var copyIcon:Class; [Bindable] [Embed(source="assets/paste.png")] public var pasteIcon:Class; protected function init():void { // 使用Actionscript创建menu //menu = Menu.createMenu(null,menu1,false); cmd_show.addEventListener(MouseEvent.CLICK,Cmd_Show_Clicked); } protected function Cmd_Show_Clicked(event:Event) { menu.show(); } ]]> </fx:Script> <fx:Declarations> <fx:XML id="config" source="config.xml" /> <!--mxml 使用外部XML文件用XMLListCollection创建数据源 除了XML相关配置,其他设定方法必须包含children项,XML,XMLList,XMLListCollection可以不必设定--> <s:XMLListCollection id="menu7" source="{config.menuitem}"/> </fx:Declarations> <s:Panel id="mix" verticalCenter="0" horizontalCenter="0" title="Mix" width="450" height="300"> <s:layout> <s:VerticalLayout gap="0"/> </s:layout> <s:Button id="cmd_show" label="Show Menu" /> <mx:Menu id="menu" showRoot="true" labelField="@label" iconField="@icon" dataProvider="{menu7}"/> </s:Panel> </s:Application>
xml配置文件
<?xml version="1.0" encoding="utf-8"?> <menuitems> <menuitem label="File" icon="folderIcon"> <children label="Open" icon="openedIcon"/> <children label="New" icon="plusIcon"/> <children label="Save" icon="saveIcon"/> <children label="Colse" icon="closeIcon"/> </menuitem> <menuitem label="Edit" icon="editIcon"> <children label="Undo" icon="undoIcon"/> <children label="Cut" icon="cutIcon"/> <children label="Copy" icon="copyIcon"/> <children label="Paste" icon="pasteIcon"/> </menuitem> <menuitem label="About" > <sub label="Help" enabled="false"> <children label="OK"/> <children label="NO"/> </sub> <sub type="separator"> </sub> <sub label="Person"> <children label="Customer" type="radio" groupName="person" toggled="true"/> <children label="Employee" type="radio" groupName="person"/> </sub> <sub label="Floor"> <children label="5F" type="check" toggled="true"/> <children label="6F" type="check" toggled="true"/> </sub> </menuitem> </menuitems>
使用MenuBar的时候稍作修改即可
<mx:MenuBar id="menubar" labelField="@label" iconField="@icon" dataProvider="{menu7}"/>
相关推荐
Flex4的菜单滑动效果,可以参考一下,move特效的使用方法
FLEX 鱼眼菜单,点击菜单3D旋转效果切换页面
里面包含源码及事例,效果类似QQ导航菜单,可实现子菜单、为菜单添加图片等功能
Flex 菜单导航特效 工程源码 不错哦
Flex自定义右键菜单
flex 鱼眼菜单flex 鱼眼菜单flex 鱼眼菜单flex 鱼眼菜单
新建flex工程 覆盖src文件夹即可 很漂亮的菜单导航 flex 自定义组件
flex常用的几种动态菜单
Flex右键菜单 flex tree 右键菜单 导入eclipse可直接用。我使用的flex sdk 版本是flex4.5.1,更改为4.0可直接使用。
超cool 的flex 菜单,flash builder 4
NULL 博文链接:https://tongqiuyan.iteye.com/blog/1207523
flex4源码 超酷menu导航 flex4
flex 自定义右键菜单 多级右键菜单flex 自定义右键菜单 多级右键菜单flex 自定义右键菜单 多级右键菜单
在xml中配置好一级菜单的图片路径,二三级菜单名称,即可生成多级系统菜单
用flex开发的一个超酷3D菜单,可以跟随鼠标移动,流畅
Flex屏蔽浏览器系统右键,实现自定义Menu的右键菜单,支持XML格式的多级菜单,以及支持菜单出现位置的自适应。欢迎大家修改,(能给出如何恢复浏览器右键菜单最好)。
NULL 博文链接:https://guangqiang.iteye.com/blog/1007618
Flex4中引入了新的ui组件,提供了更好的性能监控,并且大大提高了编译速度。《Flex 4实战》是一本全面的指南,为web设计人员和开发人员提供了Flex的详细介绍。《Flex 4实战》从基础讲起,介绍了有关表单和数据的知识...
FLEX4的皮肤skin.教你如何使用皮肤
Flex添加右键菜单,只是文档,里边有描述性的代码