1 Reply Latest reply on Jul 2, 2009 12:44 AM by DaveFastFingers

    Horizontal scroll for Tree component scrolls too far right


      I've enabled the horizontal scroll bar for the Tree component.


      But the scroll bar allows the user to scroll very far to the right into blank space.


      The maximum width of my components measures 124px, as calculated by measureWidthOfItems(0,0), and I've verified this by measuring pixels of a screen shot.


      I have tried adding an event to set the Tree.maxHorizontalScrollPosition, and I traced the value that I'm setting it to, and I also traced the value that it actually assumed after I set it. Both are 124px.


      So I can't understand the behavior. I can scroll something more like ~400px to the right with lots of blank space.


      Any ideas why?



        • 1. Re: Horizontal scroll for Tree component scrolls too far right
          DaveFastFingers Level 1

          Hmm, I'm not sure why this works, but it works, so for completeness here's what I did (in case anyone else runs across this same thread):


          var measWidth:Number = myTree.measureWidthOfItems(0,0);
          filesTree.maxHorizontalScrollPosition = measWidth - myTree.width;


          I call the above code whenever the window is resized (in my app there are 2 places that can cause a resize of the window, I manually added calls to a function with the above code). There is also an example out there that resizes any time the window is resized, but if you do this then you really can't have liveDragging=true in a DividedBox (which I have) because the cost of resizing is very high and overtaxes the cpu when called many times consecutively. I just call it when the dragging is finished (that way I have live dragging enabled, but it only updates the scroll bars when the user stops dragging, which is visually acceptable).