Hi,
I’m building a gallery under flash mx 2004. I use an xml file to store the description about each painting that has to be displayed with the picture related to it.
Here is my xml file :
<description>
<painting ref="01">
<title>Guernica</title>
<date>1937</date>
<technique>Peinture à l'huile</technique>
<size>3,51 m. x 7,82 m</size>
</painting>
<painting ref="02">
<title>ceci est une croute</title>
<date>2005</date>
<technique>Gouache</technique>
<size>21X29,7 cm</size>
</painting>
</description>
1 ) Here is a the as2 code on my button :
[AS]on (release) {
var img = “01”;
load_img (img);
}
[/AS]
2 ) Here is my as2 function loading the xml file :
[AS]
function load_description (ref_img:String) {
// … code loading the picture…getting the “id” of it by the parameter “ref_img”…
var my_xml_description:XML = new XML ();
my_xml_description.ignoreWhite = true;
my_xml_description.load (“xml/description.xml”);
my_xml_description.onLoad = function (success) {
if (success) {
affiche_description (this, ref_img);
} else {
trace (“loading error”);
}
}
}
[/AS]
3 ) Here is the as2 function wich intended to display informations about the picture stored in the “description.xml” file :
[AS]function affiche_description (node_xml:XML, reference:String) {
trace ("node_xml.childNodes[0].nodeName : " + node_xml.childNodes[0].nodeName);
trace ("node_xml.childNodes[0].childNodes[0].nodeName : " + node_xml.childNodes[0].childNodes[0].nodeName);
trace ("node_xml.childNodes[0].childNodes[0].childNodes[0].nodeName : " + node_xml.childNodes[0].childNodes[0].childNodes[0].nodeName);
trace ("node_xml.childNodes[0].childNodes[0].childNodes[0].nodeValue : " + node_xml.childNodes[0].childNodes[0].childNodes[0].nodeValue);
[/AS]
4 ) The problem is that
I can get the node names but the node value is “null”, and the nodeType of my node “<title>” returns “1”…
What’s going wrong, it’s supposed to be a text node…
How should I acess to the value of my “<title>”,"<date>", “<technique>”, and “<size>” node values ?
Thanx for your help
Regards