/ / WeatherRoom вниз потрібна альтернатива для веб-сайту - xml, flash, actionscript

Сервіс WeatherRoom потребує альтернативи для веб-сайту - xml, flash, actionscript

Гаразд я не використовую ActionScript і намагаюсь допомогтимій друг відредагуйте флеш-сайт, який змінюється на основі XML-каналу за адресою weatherroom.com, який зараз вичерпано, дед цього сайту також залишив мого друга (його клієнта). Це нинішній код нижче, чи можу я просто поміняти на іншу послугу, і не треба наймати людину, щоб зробити всі дії overcript

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 для відповіді № 1

Ви, ймовірно, збираєтеся найняти когосьінакше Причина, я кажу, полягає в тому, що будь-який інший сервіс, який ви використовуєте, має мати точно таке ж схему XML для вашого коду, щоб просто "підключитися до нього". Наприклад, _root.getCurrentCondition() це, мабуть, метод, який шукає конкретноговузол всередині XML і повертає значення у певному форматі. Якщо атрибути та текст не співпадають (ім'я, шаблон тощо), то він просто не буде працювати.

Удачі.