对于 XML 文件,我想在 actionscript 中创建一个数组,我可以在其中使用我设置的键而不是 0、1、2 等引用特定值
buildings = myParsedObjectFromXML;
var aBuildings = new Array();
for ( building in buildings ) {
var currentBuilding = buildings[building][0];
var key:String = currentBuilding.buildingCode;
aBuildings[key][property1] = currentBuilding.someOtherValue;
aBuildings[key][property2] = currentBuilding.aDifferentValue;
... etc
}
这样我就可以在以后访问数据,如下所示:
// building description
trace( aBuildings[BUILDING1][property2] );
但以上不起作用 - 我错过了什么?