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

Flex 父子窗口的数据交换

发布时间:2020-12-15 00:57:42 所属栏目:百科 来源:网络整理
导读:? Flex 中父窗口和子窗口的数据交换的实现如下. 1 在 Flex 2中弹出式窗口的API如下 Package : mx . managers PopUpManager Methods : addPopUp(window:I Flex DisplayObject,parent:DisplayObject,modal:Boolean = false,childList:String = null):void 参数
?

Flex 中父窗口和子窗口的数据交换的实现如下. 1 在Flex2中弹出式窗口的API如下 Package : mx.managersPopUpManager Methods : addPopUp(window:IFlexDisplayObject,parent:DisplayObject,modal:Boolean = false,childList:String = null):void 参数解释: window : 要弹出的对象,这对象必须实现了IFlexDisplayObject接口,比如TitleWindow. parent : 子窗口的父窗口对象. modal : 模式弹出(true)还是非模式弹出(false). childList : 弹出式对象在那个对象下弹出. PopUpManagerChildList.APPLICATION PopUpManagerChildList.POPUP PopUpManagerChildList.PARENT (默认). Class :

2 实例

  1. <?xml version="1.0" encoding="utf-8"?> ??
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"> ??
  3. <mx:Script> ??
  4. <![CDATA[ ??
  5. import mx.events.ListEvent; ??
  6. import com.demo.PersonVO; ??
  7. import mx.events.ItemClickEvent; ??
  8. import mx.collections.ArrayCollection; ??
  9. import managers.PopUpManager; ??
  10. [Bindable] ??
  11. private var testDataSource : ArrayCollection = new ArrayCollection( ??
  12. [?????? {id : 1,name :"zhangsan",language : "java"},??
  13. ??????? {id : 2,name :"lisi",language : "c++"},??
  14. ??????? {id : 3,name :"qianwu",language : "vb"},??
  15. ??????? {id : 4,name :"xiaohong",language : "pb"},??
  16. ??????? {id : 5,name :"xiaoming",language : "perl"},??
  17. ]) ??
  18. ??
  19. private function showDetailPersonInfo(event : ListEvent) : void??
  20. { ??
  21. ??????? var personVO : PersonVO =new PersonVO(); ??
  22. ?? ??
  23. ??????? personVO.id = event.currentTarget.selectedItem.id ??
  24. ??????? personVO.name = event.currentTarget.selectedItem.name; ??
  25. ??????? personVO.language = event.currentTarget.selectedItem.language; ??
  26. ?? ??
  27. ???????//hard code the detail person information ??
  28. ??????? personVO.email = "test12638@163.com"??
  29. ??????? personVO.married = false; ??
  30. ??????? personVO.workYears = "3 years"??
  31. ?? ??
  32. ??????? var personPopUpWindow : PersonInfomationPopWindow = new PersonInfomationPopWindow(); ??
  33. ??????? personPopUpWindow.personVO = personVO; ??
  34. ???????PopUpManager.addPopUp(personPopUpWindow,this,true); ??
  35. ???????PopUpManager.centerPopUp(personPopUpWindow); ??
  36. } ??
  37. ??
  38. ]]> ??
  39. </mx:Script> ??
  40. <mx:DataGrid dataProvider="{testDataSource}" width="100%" height="100%" itemClick="showDetailPersonInfo(event)"> ??
  41. <mx:columns> ??
  42. ??????? <mx:DataGridColumn dataField="id" headerText="编号" /> ??
  43. ??????? <mx:DataGridColumn dataField="name" headerText="名字" /> ??
  44. ??????? <mx:DataGridColumn dataField="language" headerText="开发语言" /> ??
  45. </mx:columns> ??
  46. </mx:DataGrid> ??
  47. </mx:Application> ??
  48. ------------------------------ ??
  49. <?xml version="1.0" encoding="utf-8"?> ??
  50. <mx:TitleWindow ??
  51. xmlns:mxml" ??
  52. width="400" ??
  53. height="300" ??
  54. showCloseButton="true" ??
  55. close="PopUpManager.removePopUp(this)"> ??
  56. <mx:VBox width="400" height="200" paddingTop="10" > ??
  57. ?????? <mx:HBox width="100%" paddingLeft="10"> ??
  58. ??????? <mx:Label width="40%" text="id:"/> ??
  59. ??????? <mx:Label text="{personVO.id}"/>?? ??
  60. ?????? </mx:HBox>??? ??
  61. ?????? <mx:Label width="40%" text="name:"/> ??
  62. ??????? <mx:Label text="{personVO.name}"/>?? ??
  63. ?????? </mx:HBox> ??
  64. ?????? <mx:Label width="40%" text="language:"/> ??
  65. ??????? <mx:Label text="{personVO.language}"/> ??
  66. ?????? </mx:Label width="40%" text="workYears:"/> ??
  67. ??????? <mx:Label text="{personVO.workYears}"/> ??
  68. ?????? </mx:Label width="40%" text="married:"/> ??
  69. ??????? <mx:Label text="{personVO.married}"/> ??
  70. ?????? </mx:HBox> ??
  71. </mx:VBox> ??
  72. <mx:Script> ??
  73. ?????? <![CDATA[ ??
  74. ???????import PopUpManager; ??
  75. ???????import com.demo.PersonVO; ??
  76. ??????? [Bindable] ??
  77. ???????public var personVO : PersonVO = null;]]> ??
  78. </mx:Script> ??
  79. </mx:TitleWindow> ??
  80. ------------------------------------------- ??
  81. package com.demo ??
  82. { ??
  83. [Bindable] ??
  84. public class PersonVO ??
  85. { ??
  86. ?? ??
  87. ??????public var id : String = ""; ??
  88. ??????public var name : String = ""; ??
  89. ??????public var language : String = ""; ??
  90. ??????public var email : String = ""; ??
  91. ??????public var workYears : String = ""; ??
  92. ??????public var married : Boolean = false; ??
  93. } ??

(编辑:李大同)

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

    推荐文章
      热点阅读