I am trying to implement a find feature on a list.
In the action script method to implement the find, I'm trying to loop over the contents of the list.dataProvider and get the contents of the labelField which is dynamic. Is there a way to use the contents of a variable to get the field out of a ObjectProxy. I see that ObjectProxy has a getProperty method, but it's protected.
Code snippet:
<mx:Canvas>
<mx:Script>
<![CDATA[
[Bindable]public var data:ArrayCollection;
[Bindable]public var name:String;
private function findItem_():void
{
for (var ii:int = 0; ii < data.length; ii+)
{
// how do I do this????
if (data[ii].<contents of name>.indexOf(findTI_.text) >= 0)
{
list.selectedIndex = ii;
break;
}
}
}
]]>
</mx:Script>
<mx:List id="list" dataProvider="{data}" labelField="{name}"; />
<mx:TextInput id="findTI" change="findItem_"/>
</mx:Canvas>
Thanks for any help.