HI,
I’m just messing around with an XML iterator, and I have a simple mapping method, that given a key, maps said key to xml and returns the relevant xml.
Now, it works if I hard code in the XML node that I want to match the key against, but thats not that flexible. So, I want to also be able to pass in the node to match against, but it seems I am getting defeated, by what I thought would be simple.
heres the method I have below;
public function mapIndex(key:String, xmlNode:*):Object {
// a nice list of my xml, but its no good if I cant compare it against my key
trace(xmlNode, _collection.elements(xmlNode)==key);
return _collection.([xmlNode] == key).length() == 0 ? _collection[0] : _collection[_collection.([xmlNode] == key).childIndex()];
//hard coded below, works fine
//return _collection.(image == key).length() == 0 ? _collection[0] : _collection[_collection.(image == key).childIndex()];
}
So, what I need to know, is how to get that xmlNode param into the correct datatype for flash to recognise it within an XML child call.
Thanks.