nata
July 30, 2003, 8:27pm
1
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:
[slideshow][slide]flower[/slide][/slideshow]
system
July 30, 2003, 8:28pm
2
hm…i’ve never seen an XML file that looked like a sea horse…
can you attach the file?
system
July 30, 2003, 8:34pm
3
only now it is a flower (instead of a horse)
system
July 30, 2003, 8:36pm
4
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.
system
July 30, 2003, 8:40pm
5
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”);
system
July 30, 2003, 8:43pm
6
Oh, stupid me, see my mistake.
Thank you a lot
now will try the variant you gave me!!!
system
July 30, 2003, 8:44pm
7
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.
system
July 30, 2003, 8:48pm
8
nice try. Just copied and pasted yours, does not work.
thank you anyway.
system
July 30, 2003, 8:57pm
9
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.