hello all,
I need some help loading xml into flash.
I made a flash test for work, but I loaded the text the hard way by doing this:
loadVariables(“text/testQ/36/question36.txt”, this);
loadVariables(“text/testQ/36/answer36.txt”, this);
Each Question and each answer are in its on folder which makes a total of 40 folders.
Is it way to load the text in each field by using xml?
I was think of doing like this
File names is test.xml
<?xml version=“1.0” encoding=“iso-8859-1”?>
<Test>
<item question=“1. How to delay an action without crashing the Flash player” answer=“a. 61 b. 65 c. 121” />
</items>
Should I make Array’s
Like so
var nodes:Array = new Array();
var question:Array = new Array();
var answers:Array = new Array();
var sXML:XML = new XML();
sXML.ignoreWhite = true;
sXML.onLoad = test;
sXML.load(“test.xml”);
then
function test(){
nodes = this.firstChild.childNodes;
for (i=0; i<nodes.length; i++){
/textbox name —question_txt—
` ----answer_txt—/
Then code for text field
question_txt.push(nodes*.attributes.question);
answer _txt.push(nodes*.attributes.answer);
}
}
sXML.load(“test.xml”);
thanx for the help
Motor