Search Flex Components Free

Custom Search

December 9, 2007

Determining the first visible item in a Flex Tree control



layout="vertical"
verticalAlign="middle"
backgroundColor="white">


import mx.events.FlexEvent;
import mx.events.ScrollEvent;
import mx.utils.ObjectUtil;

private function tree_creationComplete(evt:FlexEvent):void {
tree.expandChildrenOf(xmlDP, true);
getFirstVisibleTreeItem();
}

private function tree_scroll(evt:ScrollEvent):void {
getFirstVisibleTreeItem();
}

private function getFirstVisibleTreeItem():void {
node = tree.firstVisibleItem as XML;
}
]]>





































dataProvider="{xmlDP}"
labelField="@label"
showRoot="false"
width="50%"
rowCount="6"
scroll="tree_scroll(event);"
creationComplete="tree_creationComplete(event);" />

width="50%"
height="100%"
editable="false"
text="{node.toXMLString()}" />


Related Flex Tutorials