The code below brings back 9 instances of the photography child from the XML list. What I then want to do is when the user clicks on one of the returned values it then removes all the photography values and loads the users that have an image with that child. ie when sport is clicked ann lee will then be returned plus any other names in the XML file.
var list:XMLList = xmlinfo.profile.photography;
var totalimage:Number = list.length();
trace("length" + totalimage);
for (var i:int =0; i<totalimage; i++){
trace(xmlinfo.profile.photography[i]);
//bkg.addEventListener(MouseEvent.CLICK,gotodata);
background = new bkg();
background.y = i*40;
background.x = 20;
addChild(background);
textField = new TextField();
textField.text = list[i];
background.addChild(textField);
}
}
the XML FILE
<root> <profile> <name>ann lee</name> <photography>sport</photography> <photography>landscape</photography> <photography>still life</photography> <image>img1.jpg</image> </profile> <profile> <name>john</name> <photography>wildlife</photography> <photography>landscape</photography> <image>img2.jpg</image> </profile> </root>