flex
在父窗口监听弹出窗口里的某个按钮被点击
这样可以从子窗口拿回数据在父窗口处理数据,不必再子窗口中处理。在某些情形下省去了不少麻烦。
/**
* 右键菜单项单击事件
* changed by bin
* 2013-8-29 15:21:44
* */
private function tree_MenuItemSelected(event:MenuEvent):void
{
var menuItem:Object = event.menu.selectedItem as Object;
var currentItem:Object=XZQTreeControl.selectedItem; //cursorManager.setBusyCursor();
switch(menuItem.label)
{
case '添加':
//Alert.show("add...");
myTitleWin=myTitleWindow(PopUpManager.createPopUp(this,myTitleWindow,false));
myTitleWin.pName=currentItem.name;
myTitleWin.x=600;
myTitleWin.y=200;
myTitleWin.addEventListener(CloseEvent.CLOSE,closeWin);
//------------绑定单击事件
myTitleWin.addEventListener(MouseEvent.CLICK,btnClick);
break;
case '删除':
//Alert.show("delete...");
Alert.show("确认删除?","提示",1|2,this,deleteDialog);
break;
}
} //-----------单击事件
private function btnClick(event:MouseEvent):void
{
//---------弹出窗口的提交按钮被点击
if(event.target.id=="btnSummit"){
//Alert.show("重新刷新树");
//return;
var nodeName:String=myTitleWin.nodeName;
var pName:String=myTitleWin.pName;
if(nodeName!="" && nodeName !=null){
gateway=new RemotingService(flourineFXGatewayURL);
gateway.call("RemotingService.ShengTaiManager.InsertInfo",new Responder(onResultInsertInfo,onFault),nodeName,pName);
}else{
Alert.show("请输入产品名称");
} }
}
private function onResultInsertInfo(flag:int):void{
if(flag==1){
PopUpManager.removePopUp(myTitleWin);
myTitleWin=null;
Alert.show("已添加");
//----------------添加成功后刷新树
this.callLater(refreshTree,null);
}
else{
Alert.show("未完成添加");
}
}