Here is a layout issue I've been struggling with for many weeks now:
Essentially, I am looking for a way to size a container component as
a percentage relative to the space available to it in its parent, and
with no consideration of the size of its children.
As an example, here's the mxml for an hbox that hosts a vbox that
hosts a number of dummy components (Taken from an AIR example)...
<mx:WindowedApplication
width="400"
height="300" >
<mx:HBox
id="hboxMain"
x="0"
y="0"
width="100%"
height="100%"
autoLayout="true">
<mx:VBox
id="vboxMain"
width="200"
height="100%"
autoLayout="true">
<ns1:DummyComponent width="75" height="75"/>
<ns1:DummyComponent width="75" height="75"/>
<ns1:DummyComponent width="75" height="75"/>
</mx:VBox>
</mx:HBox>
</mx:WindowedApplication>
I've been coding in Flex for some time now, but frankly I'm still
confused over the concept of percent sizing. If I assign vboxMain
height = 100%, it will stretch to fit the available height in its
parent container, unless the height of its children exceed that
value, in which case it will stretch beyond the space alloted to it.
I am looking for the following solutions:
a) Can I somehow tell vboxMain to only size according to the space
available to it in hboxMain (not exceed hboxMain's visible space),
and to scroll or clip the content of its children?
b) Is there any way to establish the visible dimensions of a given UI
component, as opposed to its unscaled/measured/regular dimensions.
That is, if the vbox is stretched to beyond the space available to
it, I should at least be able to establish how much of it is visible
on the screen.
Some final notes:
I've noticed that scrolling/sizing behavior is often different
depending on whether the dummy controls in this particular example
are added dynamically or directly in mxml, and whether auto layout
= "true" is set dynamically.
>From what I understand the auto-layout process works from the inside
out. It's almost as if I'm seeking to reverse this process, so that
the size of a component's parent drives the layout process instead of
its children.
I would much appreciate any help you could give me on this topic.
This has been a major stumbling point for me-
Thanks!
Yarin