In theory, Math.min(verticalScrollPosition maxVerticalScrollPosition), but you might need a callLater as I'm not sure maxVerticalScrollPosition has been updated at the time of the event.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Pat Buchanan Sent: Monday, December 10, 2007 5:03 PM To: [email protected] Subject: Re: [flexcoders] verticalScrollPosition issue in a Tree It actually works quite well other than the drawing issue for the last node. Alex what is the recommended way to reposition the selected node to the top, or at least high enough to show the children if they can fit? I had tried "firstVisibleItem" in the past but could never get it to work. Thanks -Pat On 12/10/07, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: I would not expect this to work. The value of verticalScrollPosition must be <= maxVerticalScrollPosition ________________________________ From: [email protected] <mailto:[email protected]> [mailto:[email protected] <mailto:[email protected]> ] On Behalf Of Pat Buchanan Sent: Monday, December 10, 2007 4:09 PM To: [email protected] <mailto:[email protected]> Subject: [flexcoders] verticalScrollPosition issue in a Tree Greetings Flexers I've run into an issue where a tree control is drawing it's bottom nodes over the top of the root node, but ONLY when I set the tree's verticalScrollPosition and ONLY when I **collapse** the bottom nodes. I've attached a screenshot so you can see what I'm experiencing, and here is the code: private function moveToNode(event:TreeEvent): void { var nIndex:int = (event.target as Tree).itemRendererToIndex(event.itemRenderer); ( event.target as Tree).selectedIndex = nIndex; (event.target as Tree).verticalScrollPosition = nIndex; } It get's called on the Tree's itemOpen and itemClose events: itemOpen="moveToNode(event)" itemClose="moveToNode(event)" If I comment out the "verticalScrollPosition" line the problem goes away. My goal is this: When someone opens a tree node, I want to set focus to it, and bring it and it's children into view so the user does not have to scroll if they open a node near the bottom of the control. Maybe there is a better way to do this? If I don't get a quick answer I'll put together a test case application and submit to the group. Flex version: 2.0.1 Browser: IE 6 Thanks in advance, -Pat Buchanan www.DataNotion.com <http://www.datanotion.com/>

