Flex左键单击弹出菜单--使用menu组件详解

来源:互联网 发布:沈阳师范大学软件楼 编辑:程序博客网 时间:2024/05/24 03:20

具体代码参考如下:

protected function menuDemo{         //传入menu的数据定义var myMenuData:Array =[{ label:"A",enabled:true},{label: "B",enabled:true}]; var myMenu:Menu = Menu.createMenu(ecomponent, myMenuData, false);//增加时间处理函数        myMenu.addEventListener(MenuEvent.ITEM_CLICK,menuHandler);myMenu.show(100,200);}protected function menuHandler(event:MenuEvent):void  {var label:String = event.label;if(label == "A"){//do something}else if (label == "B"){//do something}}


修改Menu组件的皮肤,方法:修改main.css

Menu{backgroundColor: #000000;backgroundAlpha: 0.75;borderColor: #808080;borderStyle: solid;dropShadowColor: #000000;dropShadowEnabled: yes;color: #FFFFFF; }


参考资料链接
http://livedocs.adobe.com/flex/3/html/help.html?content=menucontrols_5.html
http://wxmfly.iteye.com/blog/420712


原创粉丝点击