1
下面的代码从XML列表中带回9个摄影子实例。然后我想要做的是,当用户点击其中一个返回值时,它将删除所有摄影值并加载具有该孩子图像的用户。即当单击运动时,将会返回安全提示,并返回XML文件中的任何其他名称。操作xml数据actionscript
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);
}
}
XML文件
<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>
你的代码看起来还好。它不是做你想做的事吗?有几种方法可以改进它,但它会做同样的事情。不太清楚你的问题实际上是什么。 – Aaron
@ user3658394感谢您的澄清。每个问题只能提出一个问题。不要将所有内容添加到评论中,请编辑您的问题。 – null
嗨亚伦。也许我没有把我的问题弄清楚。为了更加清晰,我编辑了上面的文字。我会接受你的建议:) – caribou