Hi, I am completely new to XML in Flash. I have my xml file which is calling in data to a text box in my flash movie. It’s working mostly, but it stops working and displays “Undefined”. Further explanation below:
I have this XML
<?xml version="1.0"?>
<categories>
<communicating>
<a>Learns proper word usage, pace and style especially when speaking.</a>
<b>Demonstrates an ability to organize thoughts and present them both logically and effectively using proper and appropriate language, both written and verbal. Writes, responds, and speaks publically using complete, proper sentences, which are devoid of slang. </b>
<c>Understands politeness and courtesy, and how it affects other people.</c>
<d>Explains how listening attentively is directly related to the process of learning. Demonstrates good listening skills when teacher or peers are speaking.</d>
</communicating>
<achieving>
<a>Explains the value of ethical thinking and behavior as it relates to school. Demonstrates appropriate and ethical behavior and resists negative peer pressure.</a>
<b>Recognizes the presence or absence of character traits in other people. Recognizes and celebrates positive traits displayed in the media or at times by peers.</b>
<c>Effectively applies self management skills to social challenges and explains how they help people exceed high standards of appropriate behavior.</c>
<d>Performs assignments independently with minimal supervision. Recognizes, avoids and reports potentially unsafe situations in school, the community, at home and while on the internet.</d>
<e>Utilizes time management skills as a key strategy for succeeding as a student. Remains on task and assists peers in remaining on task in group work and for completing assignments.</e>
<f>Adheres to the spirit and letter of the school's dress code. Understands why certain styles of dress, make-up, body art, or hair style may be inappropriate in certain situations. </f>
<g>Understands the relationship between competing fairly and honestly, and outcome. Demonstrates fair play, good sportsmanship and honesty in competitive situations.</g>
</achieving>
</categories>
In my .Fla I have two sections, one for communicating, that AS is as follows:
comm_a.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
}
comm_b.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
}
comm_c.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
}
comm_d.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
}
The other section is achieving, this is where I’m having problems. It will call up the first four, a-d, but say “undefined” for f-g. Here is the AS for this section:
achi_a.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
};
achi_b.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
};
achi_c.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
};
achi_d.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
};
achi_e.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[4].firstChild.nodeValue;
};
achi_f.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[5].firstChild.nodeValue;
};
achi_g.onRelease = function() {
section3_txt.text = _root.xmlData.firstChild.childNodes[0].childNodes[6].firstChild.nodeValue;
};
I checked the “List variables” from the the debug menu when it’s exported and all of my xml is displayed there. So that means it’s all being called into flash correctly right? Why would it stop working after the first 4? Does it inherit from the “communicating” (first) section?