Getting the weather

After a long search for a free service that allows requesting weather data through latitude and longitude information I finally found

They give you an easy to access xml API that lets you request current weather data and forecast. Here is my test script requesting the weather data at about the point where Edinburgh Napier Uni is.

and this is the code

var xmlLoader:URLLoader=new URLLoader  ;
var xmlData:XML=new XML  ;

var currenttemp:String;
var currentcond:String;


xmlLoader.load(new URLRequest(",-3.22&format=xml&num_of_days=2&key=#thissiwhereyourAPPIkeygoesin"));

function LoadXML(e:Event):void {
    xmlData=new XML(;

function ParseWeather(weather:XML):void {

      currenttemp = weather.current_condition.temp_C;
    currentcond = weather.current_condition.weatherDesc;
    weathertext.text = "In Edinburgh it is currently \n" +currenttemp + " C and " +currentcond;
Print Friendly

Leave a Reply

7 - five =