allright, this is the problem, i got this xml file…
<portfolio>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
<item>
<img>blaat.jpg</img>
<text>dit is het eerste stukje in men portfolio</text>
<url>http://www.campzone.nl/</url>
</item>
</portfolio>
and i need to load the info into an simple array called
portData[]
wich will be a 2 demi array like this,
portData[itemnumber][“img”]
portData[itemnumber][“txt”]
portData[itemnumber][“url”]
sounds easy… so i gave it a try,
portfolioXML = new XML();
portfolioXML.load(portfoliofile);
function loadPortfolio() {
secondList = new Array();
dataList = portfolioXML.firstChild.childNodes;
i = 0;
while (i<dataList.length) {
if (dataList*.nodeName.toLowerCase() == "item") {
secondcont = dataList*;
secondList = secondcont.childNodes;
ii = 0;
while (ii<secondList.length) {
newslist* = new Array();
if (secondList[ii].nodeName != null) {
if (secondList[ii].nodeName == "img") {
trace(i+"___"+secondList[ii].childNodes);
} else if (secondList[ii].nodeName == "text") {
trace(i+"___"+secondList[ii].childNodes);
} else if (secondList[ii].nodeName == "url") {
trace(i+"___"+secondList[ii].childNodes);
trace("");
}
}
ii++;
}
}
i++;
}
}
portfolioXML.onLoad = loadPortfolio;
now, this should work, BUT it doz it all wrong, if you let the script run, it comes up with these traces:
1___blaat.jpg
1___dit is het eerste stukje in men portfolio
1___http://www.website.com/
3___blaat.jpg
3___dit is het eerste stukje in men portfolio
3___http://www.website.com/
5___blaat.jpg
5___dit is het eerste stukje in men portfolio
5___http://www.website.com/
7___blaat.jpg
7___dit is het eerste stukje in men portfolio
7___http://www.website.com/
9___blaat.jpg
9___dit is het eerste stukje in men portfolio
9___http://www.website.com/
11___blaat.jpg
11___dit is het eerste stukje in men portfolio
11___http://www.website.com/
13___blaat.jpg
13___dit is het eerste stukje in men portfolio
13___http://www.website.com/
15___blaat.jpg
15___dit is het eerste stukje in men portfolio
15___http://www.website.com/
17___blaat.jpg
17___dit is het eerste stukje in men portfolio
17___http://www.website.com/
this is totaly wrong! for some reason, the script skips the loop each time.
anyways, i thought, what the heck, lets try to load it into an array, so i replaced the previeus code, to let the values apply on a array, code changed to:
portfolioXML = new XML();
portfolioXML.load(portfoliofile);
function loadPortfolio() {
secondList = new Array();
_global.portData = new Array();
dataList = portfolioXML.firstChild.childNodes;
i = 0;
while (i<dataList.length) {
if (dataList*.nodeName.toLowerCase() == "item") {
_global.portData* = new Array();
secondcont = dataList*;
secondList = secondcont.childNodes;
ii = 0;
while (ii<secondList.length) {
newslist* = new Array();
if (secondList[ii].nodeName != null) {
if (secondList[ii].nodeName == "img") {
_global.portData*["img"] = secondList[ii].childNodes
} else if (secondList[ii].nodeName == "text") {
_global.portData*["text"] = secondList[ii].childNodes
} else if (secondList[ii].nodeName == "url") {
_global.portData*["url"] = secondList[ii].childNodes
}
}
ii++;
}
}
i++;
}
trace(_global.portData)
}
portfolioXML.onLoad = loadPortfolio;
portfolioXML.onLoad = play();
wich will load them into an array, but when you run the script, the trace is:
,,,,,,,,,,,,,,,,,
and when i trace it OUTSIDE the function, it gives me undefind.
i mean, wtf ? what did i do wrong…
could anyone, pleaase, help me with this, im gettin frustrated here !