View Full Version : xml question
nata
July 30th, 2003, 04:27 PM
I try to display xml content in a text box with flash5, can display firstchild nodevalue, but firstchild.firstchild.nodevalue gives me always null. The xml file text is something like this:
Please, help, who can help!!!!!!!!!!!!!!!!! :hair:
flower
thoriphes
July 30th, 2003, 04:28 PM
hm...i've never seen an XML file that looked like a sea horse....;)
can you attach the file?
nata
July 30th, 2003, 04:34 PM
only now it is a flower (instead of a horse)
thoriphes
July 30th, 2003, 04:36 PM
slideshow = xmldata.firstChild;
slide = slideshow.firstChild;
slideval = slide.firstChild.nodeValue; // "flower" is a "child" of slide
anything within the tags is considered a "child".
also, i hope you're using angle brackets and not those square brackets.
nata
July 30th, 2003, 04:40 PM
yes, it looks similar to yours, but does not work:
my_xml = new XML();
my_xml.onLoad = function () { mytext = my_xml.firstchild.firstchild.nodename;};
my_xml.load("myxmlfile.xml");
nata
July 30th, 2003, 04:43 PM
Oh, stupid me, see my mistake.
Thank you a lot
now will try the variant you gave me!!!!!!!!!!
thoriphes
July 30th, 2003, 04:44 PM
when you do an onLoad with XML you have to pass a success parameter:
my_xml = new XML();
my_xml.onLoad = function (success) {
if (success) {
mytext = this.firstChild.firstChild.firstChild.nodeValue;
}
};
my_xml.load("myxmlfile.xml");
Also, within functions, you have to use "this" to refer to its own objects.
nata
July 30th, 2003, 04:48 PM
nice try. Just copied and pasted yours, does not work.
thank you anyway.
thoriphes
July 30th, 2003, 04:57 PM
hm...still doesn't work?
i'm more familiar with MX's XML code, so what I have there may be different from 5's XML.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.