我已經根據XML列表創建了一定數量的MC,並且每個都使用XML中指定的屬性/ ID進行分配。我現在試圖追溯分配的MC屬性的父母,我怎麼能這樣做?獲取XML分配的MC屬性
的XML:
<MEMBER NAME="Todd" ID="001">
<MEMBER NAME="Popia" ID="003">
</MEMBER>
<MEMBER NAME="Popia2" ID="004">
<MEMBER NAME="Awesome" ID="005">
</MEMBER>
</MEMBER>
</MEMBER>
而且here'es動作腳本
private function Members():void {
//trace(myXML.children().attribute("ID"));
xmlList=myXML.children();
for each (myXML in xmlList) {
circles.x=Math.floor(Math.random()*100)-50;
circles.y=Math.floor(Math.random()*100)-50;
circles.buttonMode=true;
circles.addEventListener(MouseEvent.CLICK, clickTarget);
addChild(circles);
circles.name=myXML.attribute("ID");
}
}
private function clickTarget(event:MouseEvent):void {
//trace(event.target.name);
//trace(event.target.parent().attribute("ID"));
//trying to trace previous assgined att MC position
trace("click");
}