Changing the height of a tree component

Im using a full screen scrollbar class that adjusts to the height of the content MC. Is there a way to adjust the height of the tree component depending on how many nodes are opened up. I have like 50 folders and once you open a few, the scrollbar in the component comes on and u scroll inside of it.

what I would like to have happen is, say all folder collapsed its 50 pixels tall, when you open a folder its now 100 pixels, I want the height of the component to adjust to however many nodes are open. I tried just doing something like myTree._height = 100; but it distorts and stretches the text…

I hope you guys can understand what im saying