我正在尝试使用共享对象来保存城市对象的数组集合。每个城市对象都包含基本字符串属性(即CITYName,State,Zipcode等)。我可以成功编写共享对象,但是在检索时我无法访问给定城市对象的内部属性。任何想法?
var tempAC:ArrayCollection = new ArrayCollection();
if( getObjects())
{
tempAC = getObject(); //returns the only shared object i currently use.
Alert.show("temp length " + tempAC.length.toString()); // current length returned is '7902' cities as expected
var i:int;
var cityObj:Object;
var tmpString:String;
//loop through array collection and collect city values;
for(i=0; i < tempAC.length(); i++)
{
cityObj= new Object();
cityObj= tempAC[i];
tmpString += "City Name: "+ cityObj[i].CITYName.toString() + " "+
cityObj.hasOwnProperty("CITYName") +"\r\n" ;
}
Alert.show(tmpString); //this alert displays "City Name [object Object] true" for
all entries in the array collection
}