Hi,
I am making a dynamic image gallery, for this i am using XML and Flash mx 2004. Here is my problem:
My XML structure is as follows:
…
<gallery>
<collection1>
<collectionname>Summer 2005</collectionname>
<images>
<itm>
<thumb>images/gallery/1/thumbs/1</thumb>
<big>images/gallery/1/1.jpg</big>
</itm>
</images>
</collection>
…another collection named collection2
…another collection named collection3
…
</gallery>
…
I use a node finding function:
function findNode(node, nodeName)
{
if (node.nodeName==nodeName)
return node;
for (var i=0; node.childNodes && i<node.childNodes.length; i++)
{
var foundNode=findNode(node.childNodes*, nodeName);
if (foundNode!=null)
return foundNode;
}
return null;
}
//got it from somewhere and it worked fine in the past
I am trying this: i need to find a collection by it’s name (collection1, collection2…) and then go to the images node and read the datas there, the items.
this is the AS i use
searchItem = “collection”+_root.colid;
var current_collectionID= findNode(rootNode,searchItem);
(rootNode is declared correct before)
It seems that this doesn’t work
i can’t access current_collectionID.childNodes[0] for example to read the name or childNodes[1] to acces the images i need.
I can’t attach the fla, it’s rather huge (this is just a small part of a website i am working on)
I hope you can help me.
Thanks