Depending on how you are calling that code, you may need to add a 
try catch block around it.  I originally had my app loading XML data 
during the initialize process.  It then fed that data directly into 
a tree.  Since the tree had data right away, that line of code 
worked fine. 

I've recently changed things a bit so that the app loads with no XML 
data loaded.  I was also getting the same eror you were until I put 
a try catch block around it.  The auto expand code was getting 
called, but since there was no data in my tree, the try catch 
prevented any errors.

You can also use:
assemblyTree.expandChildrenOf(assemblyTree.selectedItem, true);

to expand a specific node in the tree.

Wayne

--- In flexcoders@yahoogroups.com, "Sascha" <[EMAIL PROTECTED]> wrote:
>
> I know this had been brought up before and I found some stuff on 
it in the
> archive but it doesn't work for me... I want to auto-expand a Tree 
when it
> is displayed ...
> 
> objectTree.expandChildrenOf(objectTree.dataProvider[0], true);
> 
> gives me a "Cannot access a property or method of a null object 
reference."
> 
> myTree.selectedItem = myTree.dataProvider.getItemAt(0); //Mailbox 
node
> myTree.expandChildrenOf(myTree.selectedItem, true);
> 
> also doesn't work.
> 
> objectTree.selectedIndex = 0;
> objectTree.expandChildrenOf(objectTree.selectedItem, true);
> 
> Selects the first item but doesn't expand it.
> 
> What can I do to expand the tree? Any info on this would be 
appreciated!
> 
> Sascha
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to