我試圖擴展flex ArrayCollection,以便能夠搜索包含特定數據的對象並將其返回。柔性循環對象
這裏是我的功能:
public function getItemContaining(value: String): Object {
//Loop through the collection
for each(var i: Object in this) {
//Loop through fields
for(var j: String in i) {
//If field value is equal to input value
if(i[j] == value) {
return i;
}
}
}
//If not found
return null;
}
問題是j是始終空,因此第二循環永遠不會奏效。所以我讀了flex循環描述,實際上它應該工作得很好。可能是什麼問題?
這與問題中的語法有何不同? – 2010-01-28 16:05:36
不,你說得對!將編輯我的答案。 – Thomas 2010-01-28 16:20:27