hi!
Ich habe folgendes Laufzeitproblem mit meiner konfigurationsdatei (XML).
Hier ist mein Code:
ActionScript:
var _TEST = false;
var _DEBUG2SCREEN = false;
var HOST = 0;
var PORT = 0;
var RETENTION = 0;
var UEBERBLEND = 0;
main();
fscommand("fullscreen", "true");
function main() {
trace ("UEBERBLEND: " + UEBERBLEND);
getConfig();
trace ("UEBERBLEND: " + UEBERBLEND);
if (TEST) {
getXML = new XML();
getXML.load("test.xml");
// trace (myXML);
} else {
debug2S("creating getXML");
getXML = new SocketController();
debug2S("setting server parameters");
trace (HOST + ":" + PORT);
getXML.setServer("10.1.1.26", 7000);
debug2S("connecting to server");
getXML.doConnect();
getXML.onConnectSuccess = function () {
getXML.socketSend("INIT");
debug2S("sent INIT");
}
getXML.onConnectFailure = function() {
gotoAndPlay(2);
}
debug2S("Connection established");
var i:Number = 0;
debug2S("-----------------------------------------------");
getXML.onXML = function (scr) {
debug2S(Date() + ": received XML");
if (i==0) {
if (ConnectOK(scr)) {
debug2S("Server sent: " + scr);
trace ("Server sent: " + scr);
} else {
debug2S("Server did not send OK");
trace ("Server did not send OK");
}
} else {
debug2S("Server sent XML");
trace (Date() + ": Server sent XML");
trace (scr);
useXML(scr);
}
i++;
}
}
}
// read configuration from gui-config.xml
function getConfig() {
configXML = new XML();
configXML.load("gui-config.xml");
configXML.onLoad = function () {
if (configXML.childNodes[0].nodeName == "gui-config") {
serverXML = configXML.childNodes[0].firstChild;
if (serverXML.nodeName == "server_info") {
if (serverXML.firstChild.nodeName == "host" && serverXML.lastChild.nodeName == "port") {
HOST = serverXML.firstChild.firstChild.nodeValue;
PORT = serverXML.lastChild.firstChild.nodeValue;
} else {
trace ("error in gui-config.xml (host, port)!");
}
}
anzeigeXML = configXML.childNodes[0].childNodes[1];
if (anzeigeXML.nodeName == "anzeige") {
if (anzeigeXML.firstChild.nodeName == "retention_time" && anzeigeXML.lastChild.nodeName == "ueberblend_intervall") {
RETENTION = anzeigeXML.firstChild.firstChild.nodeValue;
UEBERBLEND = anzeigeXML.lastChild.firstChild.nodeValue;
trace ("UEBERBLEND: " + UEBERBLEND);
} else {
trace ("error in gui-config.xml (retention_time, ueberblend_intervall)!");
}
} else {
trace ("error in gui-config.xml! element 'anzeige' expected, " + anzeigeXML.nodeName + " was returned");
}
} else {
trace ("Error in gui-config.xml!");
}
}
}
und hier meine gui-config.xml:
<?xml version="1.0" encoding="UTF-8"?><gui-config><server_info><host>10.1.1.26</host><port>7000</port></server_info><anzeige><retention_time>120</retention_time><ueberblend_intervall>120</ueberblend_intervall></anzeige></gui-config>
hier ist der output:
UEBERBLEND: 0
UEBERBLEND: 0
0:0
Wed Nov 26 12:05:44 GMT+0100 2003: initial connection succeeded. Awaiting server response ....
UEBERBLEND: 120
Wed Nov 26 12:05:44 GMT+0100 2003: Connection to: 10.1.1.26:7000 established.
Wed Nov 26 12:05:44 GMT+0100 2003: Server sent XML
Wie gibt es das?
HIIIIILFE!!!!