Hi All!

When I add a new item to the tree node and then open this item by user input
null pointer exceptions is thrown and after that Tree behavior becomes
strange.

Steps to reproduce:

1. Run application.
2. Select My Branch node.
3. Click Add button. As a result My Leaf subnode is created as a child of My
Branch.
4. Click My Leaf disclosure icon to expland this item.
5. Exception mentioned above is thrown.

 I compile this example in Flex 2.01 and run in Flash Player 9.0.47.0.

We have found workaround. The bug can be "fixed" by setting Tree
openDuration style to 0. But I dislike workarounds. Are there any real
solutions to fix this bug?

Sergey.


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";

layout="vertical">

<mx:Script>

<![CDATA[

*import* mx.collections.XMLListCollection;

*private* *static* *const* itemsXML : XML =

<root>

<item label=*"My Branch"* isBranch=*"true"* />

</root>;

*private* *static* *const* itemsXMLListCollection : XMLListCollection =

*new* XMLListCollection(itemsXML.children());

*private* *function* onAddButtonClick() : *void* {

*var* parentXML : XML = XML(tree.selectedItem);

*var* newItemXML : XML = <item label=*"My Leaf"* isBranch=*"true"* />;

tree.dataDescriptor.addChildAt(parentXML, newItemXML, parentXML.length());

}

]]>

</mx:Script>

<mx:Tree id="tree"

labelField="@label"

showRoot="false"

dataProvider="{itemsXMLListCollection}" />

<mx:Button label="Add" click="onAddButtonClick()" />

</mx:Application>

Reply via email to