Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 27-02-2004, 16:55   #1 (permalink)
Neuer User
 
Benutzerbild von virtualize
 
Registriert seit: Aug 2003
Ort: Zürich
Beiträge: 120
Flash meldet falschen XML nodeType

Hallo,
ich lese das folgende XML File in Flash, dies wird auch sauber geparst, nur im Node <text> gibt mir Flash immer den nodeType 1, also ein XML Node.
Sollte mir doch nach meinem Verständnis den nodeType 3 zurückgeben, also eine TextNode, so dass ich den Text mit .....lastChild.nodeValue auslesen kann.

Kann mir jemand sagen wo hier der Haken ist? Oder wenigstens einen Denkanstoss geben? Vielen Dank.
ActionScript:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <scenes>
  3.     <scene name="test_scene_001">
  4.         <duration timeframe="500"/>
  5.         <background file="backgrounds/bg_001.swf"/>
  6.         <actor id="actor_nr1" file="actors/actor_001.swf">
  7.             <path file="paths/path_001.swf"/>
  8.             <beginn offset="5"/>
  9.             <textevent name="event_nr1" offset="10">
  10.                 <duration timeframe="5"/>
  11.                 <bubble type="1"/>
  12.                 <text>Hallo Du Da!</text>
  13.             </textevent>
  14.             <textevent name="event_nr2" offset="20">
  15.                 <duration timeframe="5"/>
  16.                 <bubble type="2"/>
  17.                 <text>Wer bist Du denn?</text>
  18.             </textevent>
  19.         </actor>
  20.     </scene>
  21. </scenes>
virtualize ist offline   Mit Zitat antworten
Alt 27-02-2004, 16:57   #2 (permalink)
Flash & TYPO3
 
Registriert seit: Oct 2003
Ort: Bayern
Beiträge: 2.700
Zeig mal das Script mit dem du dein XML in flash einliest!
__________________
Mediendesign-Student
johanness ist offline   Mit Zitat antworten
Alt 27-02-2004, 17:00   #3 (permalink)
Neuer User
 
Benutzerbild von virtualize
 
Registriert seit: Aug 2003
Ort: Zürich
Beiträge: 120
ActionScript:
  1. function xmlOnLoad(success) {
  2.     if (success) {
  3.         sceneXMLArray = scrxml.firstChild.firstChild.childNodes;
  4.         scene_name = scrxml.firstChild.firstChild.attributes.name;
  5.         scene_dur = Number(sceneXMLArray[0].attributes.timeframe);
  6.         scene_bgFile = sceneXMLArray[1].attributes.file;
  7.         for (i=2; i<sceneXMLArray.length; i++) {
  8.             var m = i-1;
  9.             _root["acObj_"+m] = new Object();
  10.             _root["acObj_"+m].name = sceneXMLArray[i].attributes.id;
  11.             _root["acObj_"+m].actFile = sceneXMLArray[i].attributes.file;
  12.             this["actorXMLArray"+i] = sceneXMLArray[i].childNodes;
  13.             _root["acObj_"+m].pathFile = this["actorXMLArray"+i][0].attributes.file;
  14.             _root["acObj_"+m].begin = Number(this["actorXMLArray"+i][1].attributes.offset);
  15.             for (j=2; j<this["actorXMLArray"+i].length; j++) {
  16.                 var n = j-1;
  17.                 _root["acObj_"+m]["textObj_"+n] = new Object();
  18.                 _root["acObj_"+m]["textObj_"+n].name = this["actorXMLArray"+i][j].attributes.name;
  19.                 _root["acObj_"+m]["textObj_"+n].begin = Number(this["actorXMLArray"+i][j].attributes.offset);
  20.                 _root["acObj_"+m]["textObj_"+n].dur = Number(this["actorXMLArray"+i][j].firstChild.attributes.timeframe);
  21.                 _root["acObj_"+m]["textObj_"+n].bubble = this["actorXMLArray"+i][j].firstChild.nextSibling.attributes.type;
  22.                 _root["acObj_"+m]["textObj_"+n].txt = this["actorXMLArray"+i][j].lastChild.nodeType//Hier ist der Wurm (drin)
  23.             }
  24.             delete n;
  25.             delete j;
  26.         }
  27.         delete m;
  28.         delete i;
  29.     }
  30.    
  31.     delete scrxml;
  32.     delete sceneXMLArray;
  33.     delete actorXMLArray;
  34. }
am script kanns eigentlich nicht liegen weil
ActionScript:
  1. trace(scrxml.firstChild.firstChild.firstChild.nextSibling.nextSibling.lastChild.lastChild.nodeType)
schon nodeType = 1 / nodeName = text liefert.

Geändert von virtualize (27-02-2004 um 17:15 Uhr)
virtualize 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 10:20 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele