I am using a Tree control with an XMLListContainer dataProvider…. I use an itemOpen event with the following code to update another data provider when a tree folder is opened (using small triangle) – the data provider contains all the <slide /> elements in that particular tree folder…
private function itemOpenEvent(event:TreeEvent):void { slideDP = new XMLListCollection(event.item.elements('slide')); slideDP.refresh(); }
If a second folder is opened thumbDP updates fine but when the first folder (or another closed folder) is clicked I want the same behaviour to happen (currently you have to close and reopen the first folder)
So I use a itemClick event – but this fires a ListEvent and I can’t work out how to get the child elements from the XMLListContainer as easy… The code below throws an out of bounds exception
private function itemClickEvent(event:ListEvent):void { treeFeed.getItemAt(event.rowIndex); }
Can anyone help? Thanks 🙂
I would change your event listener to listen for a change Event, and use the selectedItem property of the Tree:
You may need to cast selectedItem as XML or XMLList.