views:

34

answers:

1

OKay I don't use actionscript and trying to help my friend edit a flash website which the layout changes based on a xml feed from weatherroom.com which is now defunk, the dev of this site has also left my friend (his client). This is the current code bellow, is there anyway I can simply swap for another service and not have to hire a person to do the actionscript all overagain

updateWeatherData() {
//record old settings
var oldCondition = _root.currentCondition;
var oldWeather = _root.currentWeather;
var oldTimeset = _root.currentTimeset;
//get new settings
var newTimeObj = _root.getCurNYTime();
_root.currentTimeset = newTimeObj.timeSet /*'night'*/;
var myURL:String = 'http://www.weatherroom.com/xml/zip/12545';
var myXMLweatherData:XML = new XML();
myXMLweatherData.load(myURL);
myXMLweatherData.onLoad = function(success) {
 if (success) {
  _root.XMLWeatherFeed = this;
  //extract current condition (string)
  _root.currentCondition = _root.getCurrentCondition(_root.XMLWeatherFeed);
  //get current weather number
  _root.currentWeather = _root.getCurrentWeather(_root.currentCondition) /*2*/;
  //display
  _root.displayAllWeatherInfo(_root.XMLWeatherFeed);
  if (_root.initWeatherDone == true) {
   //compare if weather has changed
   if (oldCondition != _root.currentCondition or oldWeather != _root.currentWeather or oldTimeset != _root.currentTimeset) {
    if (_root.currentCondition != undefined and _root.currentWeather != undefined and _root.currentTimeset != undefined) {
     console.text += ('-> ' + oldCondition + ' :: ' + _root.currentCondition + '\n');
     console.text += ('-> ' + oldWeather + ' :: ' + _root.currentWeather + '\n');
     console.text += ('-> ' + oldTimeset + ' :: ' + _root.currentTimeset + '\n');
     //if it has, launch weather update
     _root.updateWeatherBackground();
    } else {
     console.text += ('--! weather server returned uncomplete data !--');
     //restore data
     _root.currentCondition = oldCondition;
     _root.currentWeather = oldWeather;
     _root.currentTimeset = oldTimeset;
    }
   } else {
    console.text += ('--! no necessary update !--');
   }
  } else {
   //tell app init has been done
   _root.initWeatherDone = true;
  }
 } else {
  //-- server is down
  //-- return partly cloudy no rain
  trace('*** SERVER IS DOWN ***');
  _root.currentWeather = 3;
  _root.initWeatherDone = true;
 }
}

}

+1  A: 

You're probably going to need to hire someone else. The reason I say that is that any other service you use is going to have to have EXACTLY the same XML layout for your code to just "plug into it." For example, _root.getCurrentCondition() is probably a method that looks for a specific node inside the XML and returns a value in a specific format. Unless the attributes and text are exactly the same (name, pattern, etc.), it's just not going to work.

Good luck.

Michael Todd