Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Some XML Help...


The xml-file looks like this

Code:
< ?xml version="1.0" encoding="ISO-8859-1" ? >
< searchResult >
< names >
< first name="Joe" nameID="27" / >
< first name="John" nameID="28" / >
< first name="Anna" nameID="37" / >
< /names >
< adresses >
< sec adress="Foostreet" city="LA" / >
< sec adress="CokeStreet" city="New York" / >
< sec adress="McDStreet" city="McDonalds" / >
< /adresses >
< /searchResult >

I read in the xml-file to flash with this code

Code:
doc = new XML();
doc.onLoad = readProduct;
searchProdAdress = "xml.xml";
trace(searchProdAdress);
doc.load(searchProdAdress);
function readProduct(success) {
if (success) {
temp = doc.firstChild.firstChild.childNodes;
temp2 = doc.firstChild.firstChild.childNodes;
len = doc.firstChild.childNodes.length;
trace("len = " add len);
for (cnt = 0; cnt < doc.firstChild.firstChild.childNodes.length; cnt++) {
var createArray = new Object();
if (temp[cnt].nodeValue == null) {
createArray.label = temp[cnt].attributes.name;
createArray.data = temp[cnt].attributes.nameID;
prodArray[cnt] = createArray;
} else {
}
}
then i thougt that I could put another for-loop after the for-loop above and get the adresses

Code:
for (c = 0; c < doc.firstChild.firstChild.childNodes.length; c++) {
var adressArray = new Object();
if (temp2[c].nodeValue == null) {
adressArray.label = temp2[c].attributes.adress;
adressArray.data = temp2[c].attributes.city;
cArray[c] = adressArray;
} else {
}
}
} else {
}
}
but that doesn´t work.
How should I do to read the adress and city stuff?
The names is firstChild.firstChild.childNodes.attributes.name
isn´t the adress also firstChild.firstChild.childNodes.attributes.adress ?




FlashKit > Flash Help > Flash MX
Posted on: 11-06-2002, 05:54 PM


View Complete Forum Thread with Replies

Sponsored Links:

    Copyright © 2005-08 www.BigResource.com, All rights reserved