R – How to force a resize from a child to a parent

actionscriptapache-flexcanvasresize

I have a page-like flex application. In my main application is a holder (a canvas) that displays all the pages. The problem is that the components that are loaded inside the holder are bigger than the holder is when the main application starts. The holder height is set to 100% but still he gets scrollbars when I load a bigger component inside of him then himself.

How can I solve this problem? And if it isn't solvable would it work correct if I use a viewstack?

–update—

the holder looks like this:

<mx:canvas height="100%">
</canvas>

But the end of the application is 500 pixels lower so canvas height is 500 pixels high. Now I put a new child inside the holder that is 1000 pixels high. Now the holder hight should be 1000 pixels high

Best Answer

Prior to adding the component to the main canvas check the size of the child component to see if its bigger than the parent. If it is then you can use scaleX and scaleY on the object to scale it down to fit in your defined area.

What you declared in your question is the default behavior for any flex container... put larger things in it and you'll get scrollbars. To eliminate the scrollbars use:

horizontalScrollPolicy="off"
verticalScrollPolicy="off

Edit:

Use "resizeToContent" on a tabNavigator or viewStack... or you can bind the width of the parent container to the width of the current child.