mad_A
03-22-2001, 10:19 AM
Hi,
I am trying to read from an external XML file into a movie. This is fine for text fields on the main timeline but will not work for bringing it into text fields within movie instances. Any idea how I can do this?
The code I am using at the moment is...
LPXML = new XML();
LPXML.load("LPtest.xml");
function populateTextFields () {
DisposableXML = new XML();
TempXML = new XML();
ClickList = new Array();
DisposableList = new Array();
ClickList = LPXML.firstChild.childNodes;
i = 0;
while (i<=ClickList.length) {
if (ClickList[i].nodeName.toLowerCase() == "click") {
DisposableXML = ClickList[i];
DisposableList = DisposableXML.childNodes;
ii = 0;
while (ii<=DisposableList.length) {
TempXML = DisposableList[ii];
if (DisposableList[ii].nodeName.toLowerCase() == "lptitle") {
lptitle = lptitle +"<font type=\"Arial\" size=\"13\" color=\"#000000\"><b>"+DisposableList[ii]+"</b></font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text1") {
text1 = text1+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text2") {
text2 = text2+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text3") {
text3 = text3+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text4") {
text4 = text4+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text5") {
text5 = text5+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text6") {
text6 = text6+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text7") {
text7 = text7+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "weblink1") {
WebLink1 = TempXML.firstChild.nodeValue ;
} else if (DisposableList[ii].nodeName.toLowerCase() == "qintro") {
questionintro = questionintro+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "questionstem") {
questionstem = questionstem+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "questionprompt") {
questionprompt = questionprompt+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "partlyright") {
partlyright = partlyright+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "incorrect") {
incorrect = incorrect+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "correctfeedback") {
correctfeedback = correctfeedback+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "cancel") {
cancel = cancel+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "option1") {
_root.option1.option1 = _root.option1.option1+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
}
ii = Number(ii)+1;
}
}
i = Number(i)+1;
}
}
LPXML.onLoad = populateTextFields;
_________
the option1.option1 at the bottom is the instace of ooption1 with a text field called option1 within it. All the rest work fine. Just not to the internal text field.
Thanks!
I am trying to read from an external XML file into a movie. This is fine for text fields on the main timeline but will not work for bringing it into text fields within movie instances. Any idea how I can do this?
The code I am using at the moment is...
LPXML = new XML();
LPXML.load("LPtest.xml");
function populateTextFields () {
DisposableXML = new XML();
TempXML = new XML();
ClickList = new Array();
DisposableList = new Array();
ClickList = LPXML.firstChild.childNodes;
i = 0;
while (i<=ClickList.length) {
if (ClickList[i].nodeName.toLowerCase() == "click") {
DisposableXML = ClickList[i];
DisposableList = DisposableXML.childNodes;
ii = 0;
while (ii<=DisposableList.length) {
TempXML = DisposableList[ii];
if (DisposableList[ii].nodeName.toLowerCase() == "lptitle") {
lptitle = lptitle +"<font type=\"Arial\" size=\"13\" color=\"#000000\"><b>"+DisposableList[ii]+"</b></font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text1") {
text1 = text1+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text2") {
text2 = text2+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text3") {
text3 = text3+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text4") {
text4 = text4+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text5") {
text5 = text5+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text6") {
text6 = text6+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "text7") {
text7 = text7+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "weblink1") {
WebLink1 = TempXML.firstChild.nodeValue ;
} else if (DisposableList[ii].nodeName.toLowerCase() == "qintro") {
questionintro = questionintro+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "questionstem") {
questionstem = questionstem+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "questionprompt") {
questionprompt = questionprompt+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "partlyright") {
partlyright = partlyright+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "incorrect") {
incorrect = incorrect+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "correctfeedback") {
correctfeedback = correctfeedback+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "cancel") {
cancel = cancel+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
} else if (DisposableList[ii].nodeName.toLowerCase() == "option1") {
_root.option1.option1 = _root.option1.option1+"<font type=\"Arial\" size=\"12\" color=\"#000000\">"+DisposableList[ii]+"</font>";
}
ii = Number(ii)+1;
}
}
i = Number(i)+1;
}
}
LPXML.onLoad = populateTextFields;
_________
the option1.option1 at the bottom is the instace of ooption1 with a text field called option1 within it. All the rest work fine. Just not to the internal text field.
Thanks!