/******
I need a faster "expandAll()" or "collaspeAll()" function for the Flex
Tree component.
I want to expand the Tree completely open or completely closed.

This is what I have so far, but its too slow for a Tree with many nodes
in it.
Plus it requires an item of the Tree to be selected first.

I think the reason it get slower is because the "Tree.openedItems"
property is an
Object containing all the opened items but not the one's I expanded at
one time.

Does anyone have cleaner,faster way?
*******/

private function expandAll(tree:Tree,open:Boolean):void
{
        var opened:Object;      
        function expand(obj:Object):void
        {       
                tree.expandChildrenOf(obj,open);
                opened=tree.openItems;                  
                for each(var o:Object in opened){       
                        if(tree.isItemOpen(o) != open){                 
                                tree.expandItem(o,open);                
                        }
                }               
        }
        expand(tree.selectedItem);
}

--Keith H--

begin:vcard
n:HAIR;KEITH
fn:KEITH HAIR
version:2.1
email;internet:[EMAIL PROTECTED]
end:vcard

Reply via email to