0
ActionScript/Adobe Air로 작업해야합니다. Java- 백그라운드에서 왔습니다. 내가 여기서 뭘 잘못하고 있는지 알아 내지 못한다. 어쩌면 누군가가 도울 수있다. 기본적으로 나는 그 함수가 가져 오는 XMLNode
을 반환하는 기능을 원합니다. (예, 순서대로)함수 내에서이 변수를 수정할 수없는 이유는 무엇입니까?
public function getXmlWebpage(address:String):XMLNode {
var service:HTTPService = new HTTPService();
var xmlResult : XMLNode = null;
service.method = "GET";
service.url = address;
service.resultFormat = HTTPService.RESULT_FORMAT_XML;
function onResult(result:ResultEvent):void{
trace("status code " + result.statusCode);
var node : XMLNode = result.result as XMLNode;
trace("node has NS URI " + node.namespaceURI);
xmlResult = node;
}
function onFail(event:FaultEvent):void{
trace("fail function of getXmlWebpage called.");
Alert.show("error communicating with host " + event.fault.toString());
}
service.addEventListener(FaultEvent.FAULT, onFail);
service.addEventListener(ResultEvent.RESULT, onResult);
service.send(null);
trace("return value will be " + xmlResult)
return xmlResult;
}
그러나 로그 말한다을 : 여기에 내가 무엇을
return value will be null
status code 200
node has NS URI http://www.w3.org/2005/Atom
을받지는 무엇입니까? xmlResult
을 onResult
으로 수정할 수 없습니까?