Dataprovider filering problem

Hello, I have a datagrid that is populated from an XML. There is then a textbox to search the datagrid being displayed.

Here’s the code, I did not write this and from what I can tell it was taken directly from adobe:

function changeHandler(event:Event):void {
    var arr:Array = dp.toArray();
    var filteredArr:Array = arr.filter(filterDataProvider);
    myDataGrid.dataProvider = new DataProvider(filteredArr);

function filterDataProvider(obj:Object, idx:int, arr:Array):Boolean {
    var txt1:String = txtSearch.text;
    var txt2:String = obj.item.substr(0, txt1.length);
    if (txt1.toLowerCase() == txt2.toLowerCase()) {
        return true;
    return false;

and I now get this error the moment I type a letter in the textfield:

TypeError: Error #1010: A term is undefined and has no properties.
at DataGridCellEditorExample/filterDataProvider()[DataGridCellEditorExample::frame57:127]
at Array$/_filter()
at Array/
at DataGridCellEditorExample/changeHandler()[DataGridCellEditorExample::frame57:121]
at fl.controls::TextInput/handleChange()[/Applications/Adobe Flash CS3/Configuration/Component Source/ActionScript 3.0/User Interface/fl/controls/]

I put some traces in after txt1 and txt2 and found that txt1 traces correctly (it’s whatever I type in the textfield) then I get the above error (and txt2 never traces).

This search USED TO WORK!! I’ve been working on other frames of this project but I didn’t do anything to this page except embed fonts in the datagrid headers. Now all of a sudden the search is broken!!

What in the world am I doing wrong?