llamo al web service usando esto:
Código :
import mx.services.*;
var weatherService:WebService = new WebService("http://www.webservicex.net/globalweather.asmx?WSDL");
weatherService.onLoad = function() {
myTemp_txt.text = "Recibiendo Clima...";
};
//
var myConditions:Object = new Object();
//
function parse(xml:XML):Void {
var firstArray:Array = xml.firstChild.childNodes;
if (firstArray.length == 0) {
trace("ERROR: "+xml);
} else {
for (var i = 0; i<firstArray.length; i++) {
//
myConditions[firstArray[i].nodeName] = firstArray[i].firstChild;
}
//
myTemp_txt.text = myConditions.Temperature;
}
}
//
function checkWeather(city:String):Void {
var weatherResult:Function = weatherService.GetWeather(city);
weatherResult.onResult = function(result) {
var myResult:String = escape(result);
//
myResult = (unescape(myResult.split("%0D%0A").join("")));
//
myResult = myResult.split(" ").join("");
//
var myWeather:XML = new XML(myResult);
parse(myWeather);
};
weatherResult.onFault = function(fault) {
//
trace(fault.faultCode+","+fault.faultstring);
};
}
//
// buscamos la ciudad en cuestion
checkWeather("Mexico City");y todo eso cae en una cajita de texto dinamico que se llama myTemp_txt
ojala y alguien me pueda ayudar, muchas gracias!!
Arturo
