Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 26-11-2003, 11:06   #1 (permalink)
Neuer User
 
Registriert seit: Jun 2003
Ort: Wien
Beiträge: 166
und wann wird da was geladen?

hi!

Ich habe folgendes Laufzeitproblem mit meiner konfigurationsdatei (XML).

Hier ist mein Code:

ActionScript:
  1. var _TEST   = false;
  2. var _DEBUG2SCREEN   = false;
  3. var HOST        = 0;
  4. var PORT        = 0;
  5. var RETENTION   = 0;
  6. var UEBERBLEND  = 0;
  7.  
  8.  
  9. main();
  10. fscommand("fullscreen", "true");
  11.  
  12. function main() {
  13.     trace ("UEBERBLEND: " + UEBERBLEND);
  14.     getConfig();
  15.     trace ("UEBERBLEND: " + UEBERBLEND);
  16.     if (TEST) {
  17.         getXML  = new XML();
  18.         getXML.load("test.xml");
  19. //    trace (myXML);
  20.     } else {
  21.         debug2S("creating getXML");
  22.         getXML  = new SocketController();
  23.         debug2S("setting server parameters");
  24.         trace (HOST + ":" + PORT);
  25.         getXML.setServer("10.1.1.26", 7000);
  26.         debug2S("connecting to server");
  27.         getXML.doConnect();
  28.         getXML.onConnectSuccess = function () {
  29.             getXML.socketSend("INIT");
  30.             debug2S("sent INIT");
  31.         }
  32.         getXML.onConnectFailure = function() {
  33.             gotoAndPlay(2);
  34.         }
  35.    
  36.         debug2S("Connection established");
  37.  
  38.         var i:Number = 0;
  39.         debug2S("-----------------------------------------------");
  40.         getXML.onXML = function (scr) {
  41.             debug2S(Date() + ": received XML");
  42.             if (i==0) {
  43.                 if (ConnectOK(scr)) {
  44.                     debug2S("Server sent: " + scr);
  45.                     trace ("Server sent: " + scr);
  46.                 } else {
  47.                     debug2S("Server did not send OK");
  48.                     trace ("Server did not send OK");
  49.                 }
  50.             } else {
  51.                 debug2S("Server sent XML");
  52.                 trace (Date() + ": Server sent XML");
  53.                 trace (scr);
  54.                 useXML(scr);   
  55.             }
  56.             i++;
  57.         }
  58.     }
  59. }
  60.  
  61. //  read configuration from gui-config.xml
  62. function getConfig() {
  63.     configXML   = new XML();
  64.     configXML.load("gui-config.xml");
  65.     configXML.onLoad = function () {
  66.         if (configXML.childNodes[0].nodeName == "gui-config") {
  67.             serverXML   = configXML.childNodes[0].firstChild;
  68.             if (serverXML.nodeName == "server_info") {
  69.                 if (serverXML.firstChild.nodeName == "host" && serverXML.lastChild.nodeName == "port") {
  70.                     HOST    = serverXML.firstChild.firstChild.nodeValue;
  71.                     PORT    = serverXML.lastChild.firstChild.nodeValue;
  72.                 } else {
  73.                     trace ("error in gui-config.xml (host, port)!");
  74.                 }
  75.             }
  76.             anzeigeXML  = configXML.childNodes[0].childNodes[1];
  77.             if (anzeigeXML.nodeName == "anzeige") {
  78.                 if (anzeigeXML.firstChild.nodeName == "retention_time" && anzeigeXML.lastChild.nodeName == "ueberblend_intervall") {
  79.                     RETENTION   = anzeigeXML.firstChild.firstChild.nodeValue;
  80.                     UEBERBLEND  = anzeigeXML.lastChild.firstChild.nodeValue;
  81.                     trace ("UEBERBLEND: " + UEBERBLEND);
  82.                 } else {
  83.                     trace ("error in gui-config.xml (retention_time, ueberblend_intervall)!");
  84.                 }
  85.             } else {
  86.                 trace ("error in gui-config.xml! element 'anzeige' expected, " + anzeigeXML.nodeName + " was returned");
  87.             }
  88.         } else {
  89.             trace ("Error in gui-config.xml!");
  90.         }
  91.     }
  92. }

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!!!!
JuRo ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 07:59 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele