1. Курсор ищет только в открытых ветках.
2. selectedItem и selectedIndex выделяют элемент, только в открытых ветках.
Вот пример рекурсивного поиска по иерархическим данным.

Код AS3:
<?xml version="1.0" encoding="utf-8"?>
<s:Application name="Hierarchical Search"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.HierarchicalCollectionView;
import mx.collections.HierarchicalData;
import mx.collections.ICollectionView;
import mx.collections.IViewCursor;
private var _data:HierarchicalCollectionView;
private function get data():HierarchicalCollectionView
{
if (!_data)
{
var dataSource:ArrayCollection = new ArrayCollection([
{label:"first", children: (new ArrayCollection([{label: "sub1"}, {label: "sub2"}]))},
{label:"second", children: (new ArrayCollection([{label: "sub1"}, {label: "sub2"}]))}
]);
var hd:HierarchicalData = new HierarchicalData(dataSource);
var hcv:HierarchicalCollectionView = new HierarchicalCollectionView(hd);
_data = hcv;
}
return _data;
}
protected function searchButton_clickHandler(event:MouseEvent):void
{
if (searchInput.text != '')
{
var regexp:RegExp = new RegExp(searchInput.text, "i");
var path:Array = findPath(regexp, data);
if (path)
{
while (path.length != 1)
{
//открываем все ветви до искомого элемента
dg.expandItem(path.shift(), true);
}
//выделяем искомый элемент
dg.selectedItem = path.shift();
}
}
}
/**
* Ищет путь до искомого элемента
*
* @param regexp регулярное выражение для label
*
* @param collection коллекция вида
* <code>var dataSource:ArrayCollection = new ArrayCollection([
* {label:"first", children: (new ArrayCollection([{label: "sub1"}, {label: "sub2"}]))},
* {label:"second", children: (new ArrayCollection([{label: "sub1"}, {label: "sub2"}]))}
* ]);</code>
*
* @return массив вида [parent, parent, item]
*/
private function findPath(regexp:RegExp, collection:ICollectionView):Array
{
var cursor:IViewCursor = collection.createCursor();
if (!cursor.afterLast)
{
do
{
var item:Object = cursor.current;
if (regexp.test(item.label))
{
return [item];
}
if (item.hasOwnProperty("children") && item.children is ICollectionView)
{
var child:Array = findPath(regexp, item.children);
if (child)
{
return [item].concat(child);
}
}
}
while (cursor.moveNext());
}
return null;
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:HGroup>
<s:TextInput id="searchInput"/>
<s:Button id="searchButton" label="search" click="searchButton_clickHandler(event)"/>
</s:HGroup>
<mx:AdvancedDataGrid id="dg" dataProvider="{data}" width="100%" height="100%">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="label"/>
</mx:columns>
</mx:AdvancedDataGrid>
</s:Application>