flex
在父窗口监听弹出窗口里的某个按钮被点击
这样可以从子窗口拿回数据在父窗口处理数据,不必再子窗口中处理。在某些情形下省去了不少麻烦。
1 /** 2 * 右键菜单项单击事件 3 * changed by bin 4 * 2013-8-29 15:21:44 5 * */ 6 private function tree_MenuItemSelected(event:MenuEvent):void 7 { 8 var menuItem:Object = event.menu.selectedItem as Object; 9 var currentItem:Object=XZQTreeControl.selectedItem; 10 11 //cursorManager.setBusyCursor(); 12 switch(menuItem.label) 13 { 14 case '添加': 15 //Alert.show("add..."); 16 myTitleWin=myTitleWindow(PopUpManager.createPopUp(this,myTitleWindow,false)); 17 myTitleWin.pName=currentItem.name; 18 myTitleWin.x=600; 19 myTitleWin.y=200; 20 myTitleWin.addEventListener(CloseEvent.CLOSE,closeWin); 21 //------------绑定单击事件 22 myTitleWin.addEventListener(MouseEvent.CLICK,btnClick); 23 break; 24 case '删除': 25 //Alert.show("delete..."); 26 Alert.show("确认删除?","提示",1|2,this,deleteDialog); 27 break; 28 } 29 } 30 31 //-----------单击事件 32 private function btnClick(event:MouseEvent):void 33 { 34 //---------弹出窗口的提交按钮被点击 35 if(event.target.id=="btnSummit"){ 36 //Alert.show("重新刷新树"); 37 //return; 38 var nodeName:String=myTitleWin.nodeName; 39 var pName:String=myTitleWin.pName; 40 if(nodeName!="" && nodeName !=null){ 41 gateway=new RemotingService(flourineFXGatewayURL); 42 gateway.call("RemotingService.ShengTaiManager.InsertInfo",new Responder(onResultInsertInfo,onFault),nodeName,pName); 43 }else{ 44 Alert.show("请输入产品名称"); 45 } 46 47 } 48 } 49 private function onResultInsertInfo(flag:int):void{ 50 if(flag==1){ 51 PopUpManager.removePopUp(myTitleWin); 52 myTitleWin=null; 53 Alert.show("已添加"); 54 //----------------添加成功后刷新树 55 this.callLater(refreshTree,null); 56 } 57 else{ 58 Alert.show("未完成添加"); 59 } 60 }