Flex 调用父组件的父组件中的步骤

Flex 调用父组件的父组件中的方法

我在myDayReport.mxml中定义了一个用来刷新的方法:

public function refresh_callbackHandler():void
			{
				pagingFunction(0, 13);
			}

在myDayReport.mxml中点击新建日报会弹出一个窗口:AddReport.mxml。

在AddReport.mxml的ViewStack中包含了另一个窗口:AddReport1.mxml。

我在AddRepot1.mxmxl中每当我保存信息后,我希望调用myDayReport.mxml中的refresh_callbackHandler方法。我可以这样做:

在AddReport1.mxml中定义了变量iparent

public var iparent:Sprite;

然后在需要调用的地方写上:

((iparent as AddReport).iparent as myDayReport).refresh_callbackHandler();

再在AddReport.mxml文件中定义变量:

public var iparent:Sprite;

搞定