加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex menubar

发布时间:2020-12-15 04:28:15 所属栏目:百科 来源:网络整理
导读:Java代码 ?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" minWidth= "955" minHeight= "600" fx:Script ![C
Java代码

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
  3. xmlns:s="library://ns.adobe.com/flex/spark"
  4. xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
  5. <fx:Script>
  6. <![CDATA[
  7. import mx.events.MenuEvent;
  8. private function menuClickHandle(e:MenuEvent):void{
  9. switch(e.label){
  10. case "submenu1":currentState="index1";break;
  11. case "submenu2":currentState="index2";break;
  12. case "submenu3":currentState="index3";break;
  13. case "submenu4":currentState="index4";break;
  14. case "submenu5":currentState="index5";break;
  15. }
  16. }
  17. ]]>
  18. </fx:Script>
  19. <s:states>
  20. <s:State name="index1" />
  21. <s:State name="index2" />
  22. <s:State name="index3" />
  23. <s:State name="index4" />
  24. <s:State name="index5" />
  25. </s:states>
  26. <fx:Declarations>
  27. <!-- 将非可视元素(例如服务、值对象)放在此处 -->
  28. <fx:XMLList id="myXMLList">
  29. <item id="menu1">
  30. <item id="submenu1" type="radio" groupName1="one" />
  31. <item id="submenu2" type="radio" groupName2="one" />
  32. </item>
  33. <item id="menu2" />
  34. <item id="menu3" />
  35. <item id="menu4" >
  36. <item id="submenu3" type="radio" groupName="two" />
  37. <item id="submenu4" type="radio" groupName="two" selected="true" />
  38. <item id="submenu5" type="radio" groupName="two" />
  39. </item>
  40. </fx:XMLList>
  41. </fx:Declarations>
  42. <mx:MenuBar y="24" id="myMenubar" dataProvider="{myXMLList}" labelField="@id" width="293" horizontalCenter="0" change="menuClickHandle(event)" change.index2="menuClickHandle(event)"></mx:MenuBar>
  43. <s:Group id="group1" includeIn="index1" x="{myMenubar.x}" y="{myMenubar.y+myMenubar.height}">
  44. <s:Rect width="{myMenubar.width}" height="248" alpha="0.5">
  45. <s:fill>
  46. <mx:SolidColor color="#000000" />
  47. </s:fill>
  48. </s:Rect>
  49. </s:Group>
  50. <s:Group id="group2" includeIn="index2" x="{myMenubar.x}" y="{myMenubar.y+myMenubar.height}">
  51. <s:Rect width="{myMenubar.width}" height="248" alpha="0.5">
  52. <s:fill>
  53. <mx:SolidColor color="#f5e532" />
  54. </s:fill>
  55. </s:Rect>
  56. </s:Group>
  57. <s:Group id="group3" includeIn="index3" x="{myMenubar.x}" y="{myMenubar.y+myMenubar.height}">
  58. <s:Rect width="{myMenubar.width}" height="248" alpha="0.5">
  59. <s:fill>
  60. <mx:SolidColor color="#bdf531" />
  61. </s:fill>
  62. </s:Rect>
  63. </s:Group>
  64. <s:Group id="group4" includeIn="index4" x="{myMenubar.x}" y="{myMenubar.y+myMenubar.height}">
  65. <s:Rect width="{myMenubar.width}" height="248" alpha="0.5">
  66. <s:fill>
  67. <mx:SolidColor color="#d731f5" />
  68. </s:fill>
  69. </s:Rect>
  70. </s:Group>
  71. </s:Application> ?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读