特定のデータを含むオブジェクトを検索して返すことができるように、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 が常に null であるため、2 番目のループが機能しないことです。だから私はフレックスループの説明を読んで、実際にはうまくいくはずです。何が問題になる可能性がありますか?