嗨,我正在编写一个具有 MainMovie 的 flex 应用程序,该应用程序根据用户在 MainMovie 中选择的内容加载 flex 程序(ChildMovie)。下面是一些伪代码,希望能帮助我描述我的问题。
class MainMovie{
private var request:URLRequest = new URLRequest();
public function callPHPfile(param:String, loader:URLLoader,
handlerFunction:Function):void {
var parameter:URLVariables=new URLVariables();
parameter.param = param;
request.method = URLRequestMethod.POST;
request.data = parameter;
request.url = php file on server;
loader.addEventListener(Event.COMPLETE, handlerFunction);
loader.load(request);
}
}
Class ChildMovie {
private var loaderInChild:URLLoader = new URLLoader();
public function handlerInChild(e:Event):void {
process data....
loaderInChild.removeEventListerner(Event.COMPLETE, handlerInChild);
}
private function buttonClickHandler(e:Event):void{
Application.application.callPHPfile(param, loaderInChild, handlerInChild)
}
}
我可以看到 callPHPfile 函数正在执行并从 httpFox 中接收 xml 数据,问题是 handlerInChild 函数中的代码没有被执行。我在这里做错了什么?