Flex中menu菜单

  Flex中生成菜单:
  1. <?xml version="1.0"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
  3.     layout="absolute">
  4.     <mx:Script>
  5.         <![CDATA[
  6.             import mx.controls.Menu;
  7.             // Method to create an Array-based menu. 
  8.             private function createAndShow():void {
  9.                 // The third parameter sets the showRoot property to false.
  10.                 // You must set this property in the createMenu method, 
  11.                 // not later.
  12.                 var myMenu:Menu = Menu.createMenu(null, menuData, true);//定义了一个menu
  13.                 myMenu.show(1010);//menu show的显示位置
  14.             }
  15.             // The Array data provider(数据提供)
  16.             [Bindable] 
  17.             public var menuData:Array = [
  18.                 {label: "MenuItem A", children: [//设置复选框
  19.                     {label: "SubMenuItem A-1", enabled: false},//表示是不可选的
  20.                     {label: "SubMenuItem A-2", type: "normal"//一般状态
  21.                     ]},//没设置选择type就没选择后的提示
  22.                 {label: "MenuItem B", type: "check", toggled: true},//toggled表示是否勾选
  23.                 {label: "MenuItem C", type: "check", toggled: false},
  24.                 {type: "separator"},//设置分割线
  25.                 {label: "MenuItem D", children: [
  26.                     {label: "SubMenuItem D-1", type: "radio"//表示同组单选的
  27.                         groupName: "g1"},
  28.                     {label: "SubMenuItem D-2", type: "radio"
  29.                         groupName: "g1", toggled: true}, 
  30.                     {label: "SubMenuItem D-3", type: "radio"
  31.                         groupName: "g1"
  32.                     ]} 
  33.                 ];
  34.         ]]>
  35.     </mx:Script>
  36.     <!-- Button control to create and open the menu. -->
  37.     <mx:Button x="300" y="10" 
  38.         label="Open Menu" 
  39.         click="createAndShow();"/>
  40. </mx:Application>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值