flex弹出窗口与父窗口的交互实现(用回调函数)
弹出子窗口代码:
protected function addBtn_clickHandler(event:MouseEvent):void
???{
????var addInfoWin:RInfoPanel = RInfoPanel(PopUpManager.createPopUp(this,RInfoPanel,true));
????addInfoWin.mainApp = this;
????//调用回调函数。用来刷新父窗口。
????addInfoWin.callBackFunction = init;//init是父窗口的初始化程序。调用它用来刷新父窗口数据
????addInfoWin.isPopUp = true;
????PopUpManager.centerPopUp(addInfoWin);
????
???}
子窗口回调函数访问父窗口
[Bindable]
???public var callBackFunction:Function;//回调函数
???[Bindable]
???public var mainApp:Object = null;
if(effectRows == 1)
????{
?????Alert.show("添加成功!");
?????
?????PopUpManager.removePopUp(this);
?????callBackFunction.call(mainApp);?//回调函数。也可传递参数,但传参只能是 字符串!!!
????}