public class LoadXML { public static const loadXMLCompleteEvent:String = "load_xml_complete"; public static const loadXMLFaultEvent:String = "load_xml_fault";
public static var remoteStr:String = "";
public static var moduleList:XMLList;
private static var http:HTTPService = null;
public function LoadXML() { }
public static function loadXml(url:String="configData.xml"):void { http = new HTTPService(); http.url = url; http.resultFormat = "e4x"; http.addEventListener(ResultEvent.RESULT,xmlresult); http.addEventListener(FaultEvent.FAULT,xmlfault); http.send();
function xmlresult(event:ResultEvent):void { var configXML:XML = event.result as XML; if(configXML) { // 网站根目录ip地址 var server:String = (configXML.child("server") as XMLList)[0].toString(); Constants.SERVER = server;