Archive for November, 2010

Flex tree event ITEM_CLOSE and ITEM_OPEN dispatched too soon

I’m not really sure if Adobe would agree that these events are dispatched too soon, but here’s the story.

If you manually click on a tree item that has children, the tree component processes this event immediately and dispatches one the mentioned events. If you are listening to these events, you will find out that during handling the event, the tree property ‘isItemVisible’ does not give expected results.

I would expect that handling the event ITEM_CLOSE, the property ‘isItemVisible’ would return false for the closed item and its children. But this is not true, because at this point the tree has not updated the variable ‘visibleData’ that is used in the method ‘isItemVisible’. The variable ‘visibleData’ is updated in the function updateDisplayList(). So you’ll have to wait for the event updateComplete if you want to access an updated ‘isItemVisible’.

No Comments