我正在尝试访问 onComplete 函数中的 data_file 值,但老实说,我什至不确定我是否正确调用它。
public function version():String{
var string_val = "";
var data_file = "";
//var request:URLRequest = new URLRequest("indexdynamic.php");
var request:URLRequest = new URLRequest("http://localhost/indexdynamic.php");
request.method = URLRequestMethod.POST;
var verVars:URLVariables = new URLVariables();
request.data = verVars
var loader:URLLoader = new URLLoader(request);
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
function onComplete(event:Event):String{
string_val = event.target.data.Var.toString();
if (string_val == "First Selection") {
data_file = "fill_in_blanks_doi.xml";
}else {
data_file = "fill_in_blanks_2_doi.xml";
}
return data_file;
}
var data_file = onComplete(loader.COMPLETE);
return data_file;
}