在 AS3 中,如何按字母顺序对该列表进行排序?我不是编程专家,我很难弄清楚这一点。
var searchObject:Object = new Object();
var mapXML:XML;
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("interactive-map.xml"));
xmlLoader.addEventListener(Event.COMPLETE, parseXML);
function parseXML(event:Event):void {
mapXML = new XML(event.target.data);
for each (var locationElement:XML in mapXML.maplocation) {
searchObject.locationname = locationElement.attribute("locationname");
searchObject.category = locationElement.attribute("category");
trace("Location Name: " + searchObject.locationname);
}
}