2009-07-03 6 views
0

좋습니다. actionscript를 사용하지 않고 내 친구가 weatherroom.com의 XML 피드를 기반으로 레이아웃이 변경되는 플래시 웹 사이트를 편집하는 데 도움을 주려고합니다. 이 사이트는 또한 내 친구 (그의 고객)를 떠났습니다. 이것은 내가 다른 서비스를 교환 간단하고 당신은 아마에 필요 해요 액션 스크립트의 모든 overagainWeatherRoom 서비스가 다운 된 대신 웹 사이트의 대안이 필요합니다.

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

을 할 사람을 고용 할 수 없습니다 어쨌든이, 현재 코드 우는 소리입니다 다른 사람을 고용하십시오. 필자가 말한 이유는 사용하는 다른 서비스가 코드에 "플러그 인"하는 것과 똑같은 XML 레이아웃을 가지고 있어야하기 때문입니다. 예를 들어 _root.getCurrentCondition()은 XML 내의 특정 노드를 찾고 특정 형식의 값을 반환하는 메서드 일 수 있습니다. 속성과 텍스트가 정확히 동일하지 않으면 (이름, 패턴 등) 작동하지 않을 것입니다.

행운을 빈다.

관련 문제