
September 28th, 2006, 10:53 PM
|
|
Junior Member
|
|
Join Date: Sep 2006
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I having some difficulties to retrieve a variable from an XML file (please help)
I having some difficulties to retrieve a variable from an XML file
I have a problem to view the “date” attribute in my flash project
I am using this line in the acrionscript but I is not working
Code:
my_txt3 = nodes[i].firstChild.attributes.date + "\n\n"
Thank You
XML:
Code:
<?xml version="1.0"?>
<comments>
<item date='343434'>flash flash flash
<p> </p>
</item>
<item date='121212'>test test
<p> </p>
</item>
</comments>
ActionScript:
Code:
var theXML:XML = new XML();
theXML.ignoreWhite = true;
my_txt = "";
theXML.onLoad = function() {
var nodes:Array = theXML.firstChild.childNodes;
for(i=0; i<nodes.length; i++) {
my_txt3 = nodes[i].firstChild.attributes.date + "\n\n"
my_txt4 = nodes[i].firstChild.nodeValue + "\n";
my_txt4 = my_txt4.split("\n").join("");
my_txt += my_txt3 + my_txt4;
}
my_txt2.text = my_txt;
}
theXML.load("con_flash4.php")
|