/ / Il servizio WeatherRoom richiede un'alternativa per un sito Web: xml, flash, actionscript

Il servizio WeatherRoom down necessita di un'alternativa per un sito Web: xml, flash, actionscript

OK, non uso actionscript e sto cercando di aiutareil mio amico modifica un sito web in flash che cambia il layout in base a un feed xml di weatherroom.com che ora è defunk, ma anche lo sviluppatore di questo sito ha lasciato il mio amico (il suo cliente). Questo è il codice corrente qui sotto, c'è comunque che posso semplicemente scambiare per un altro servizio e non dover assumere una persona per fare l'actionscript tutto 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;
}
}

}

risposte:

1 per risposta № 1

Probabilmente avrai bisogno di assumere qualcunoaltro. La ragione per cui dico che qualsiasi altro servizio che si utilizza dovrà avere ESATTAMENTE lo stesso layout XML per il proprio codice semplicemente "collegarlo". Per esempio, _root.getCurrentCondition() è probabilmente un metodo che cerca uno specificonodo all'interno dell'XML e restituisce un valore in un formato specifico. A meno che gli attributi e il testo siano esattamente gli stessi (nome, modello, ecc.), Non funzionerà.

In bocca al lupo.