Hm I guess you're right, Flex 4 probably always worked this way, I just
somehow never hit this "issue" and in Flex 3 / MX layouts work as expected
(for example, if you put anything inside a Canvas and set a width and height
of that something to 100%, it will always have the width and height equal to
the Canvas dimensions).

After some stepping through the Flex 4 layout code, it seems that you are
right that `minWidth` is to "blame" here. What seems intuitively strange to
me are these two things:

1) The layout (BasicLayout in this case but other layouts do this too) sets
the `measuredMinWidth` to be equal to `measuredWidth`. First, this feels
intuitively wrong (how can a generic layout class possibly know what the
right minWidth for a specific contents should be?; the value of
measuredWidth is just one of the possible guesses and it is not correct in
many cases). What is for sure is that the measuredMinWidth, when it's too
high, later causes all the trouble with layouts.

2) This issue only happens when sizing is done using percent values or
constraints (left, right etc.), all is OK when using absolute sizes. This
really surprises me as I am not aware about any note in the documentation or
anywhere that would say that using % instead of px would have such deep
layout consequences. At least in Flex 3, you can set the size either way and
they are just equivalent (I hope; I always took that as granted).

I guess there is no way this could be changed after Flex 4 has been released
so long ago but if anyone who maintains the documentation is reading this,
it would be great if this behavior could be documented and possibly advised
to use `minWidth` explicitly to overcome this issue if someone hits it.

Thanks,
Borek



--
View this message in context: 
http://apache-flex-development.2333347.n4.nabble.com/Spark-and-percent-width-unexpected-behavior-tp33190p33256.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Reply via email to