Components Flex



    
        
            import mx.controls.Alert;
            import mx.collections.XMLListCollection;
        
            [Bindable]
            private var searchResult:XMLList;
            private var searchResultIndex:uint = 0;
            private function findByName(event:MouseEvent):void
            {
                var searchStr:String = "A1";
                tree.expandChildrenOf(data[0], false);
                searchResult = data.node.node.(@name.toLowerCase().search(searchStr.toLowerCase()) > -1);
                searchResultIndex = 0;
                if (searchResult[searchResultIndex] != undefined)
                    expandNode(searchResult[searchResultIndex]);
            }
            private function expandNode(xmlNode:XML):void
            {
                while (xmlNode.parent() != null) {
                    xmlNode = xmlNode.parent();
                    tree.expandItem(xmlNode, true, false);
                    tree.selectedItem = searchResult[searchResultIndex];
                }
            }
      
    

    
    
        
            
                
                
                
                
            

            
                
                
                
            
            
                
                
                
            
        
    
    
    
              
        
                    showRoot="false" dataProvider="{data}" 
            labelField="@name" />