Actionscript -> Any article about the difference between getLayoutBoundsHeight and getPreferedBoundsHeight - apache-flex

Can't find any article about the difference . Does somebody know one?

getLayoutBoundsHeight will do this:
Returns the element's layout height. This is the size that the element
uses to draw on screen.
getPreferredBoundsHeight will do this:
Returns the element's preferred height.
In the context of Flex, the size of a component is always determined by its' parent. A component cannot size itself. A measure() method must be implemented--it is part of the component lifeCycle--and it will set the measuredHeight (and measuredWidth) of a component. So, the layoutBoundsHeight is the actual height. The preferredBoundsHeight is the desired height. In Flex, especially when dealing with layout containers or percentage layouts, Flex may make decisions to size a component differently than the measured size.

Related

CSS Why width is wrong?

I have a web page as follows (see img)
A certain div has a width of 100% which is filling the whole viewport.
When checking on Chrome, the viewport size is 500px while the CSS size is 536.
Does anyone have an idea why it's different please ?
Thanks.
Cheers,
Many modern visualization techniques, such as parallax, require larger elements than the actual viewport size and a smart usage of transform properties in order to create particular visual effects and/or illusions.
Your picture is actually showing a part of the parent element displaying properties particular to such techniques, clearly showing: -webkit-logical-width:800px and perspective-origin: 400px 300px.
For any element with a position value other than fixed, width:100% usually results into the child having an equal width with the parent, not with the viewport. There are notable exceptions from this rule, though.
If you need a more in-depth explanation as to why does the parent have a different width than the viewport (and it's parent parent, and so on... - all the way to the viewport), you need to post a Minimal, complete and verifiable example and I'll lay down each of the ancestors of your element affecting its width.
If, on the contrary, you don't really need to know what's going on at parents level, but are looking for a way to make your current element as wide as the viewport, you probably want to give it a width value of 100vw.

Set min-width equal to height?

It's easy enough to set an element's height depending on its width using tricks such as setting margin-top: AR%, with AR being the aspect ratio of the element.
However, I'd like to do something the other way around.
Namely, I'd like to set the element's min-width to be equal to the element's height, which may be dynamic based on content.
If this isn't possible, that's okay - it's only needed for user-generated content, since the cases where I use it have a static and known height! It's fairly minor, but if it can be done then that'd be great.
Anyone got any ideas?

How does intrinsic work?

I have never heard of this intrinsic value before until I come across this page on MDN.
From what I know intrinsic means natural. So how does this work out in CSS. I thought that auto would have been natural. I've searched around a bit but can't find anything on it.
What does it do different than auto?
The example I saw was max-width: intrinsic;
It looks like the intrinsic value is part of the newer CSS3 sizing module:
http://dev.w3.org/csswg/css-sizing/
I have not used it yet but perhaps the reference will provide you with more information.
Based on a quick review, this module would make it easier to specify how content fills the width and height of a parent containing block.
At the moment, JavaScript functions are often used to compute widths and heights of container blocks based on % values for variable child elements content.
It allows you to set the width of an element to stretch wide enough to accommodate its children. So, if a div element contained a wide image and some text, the div would stretch wide enough to accommodate the image, and the text would begin breaking at that threshold.
Definitely experimental and not widely supported: http://caniuse.com/intrinsic-width
Intrinsic sizing determines sizes based on the contents of an element,
without regard for its context.
http://dev.w3.org/csswg/css-sizing/#intrinsic-sizing
I have found that in iOS8, flexbox children may not always try to contain all their children and instead max their height to the available viewport.
min-height: min-intrinsic fixes that problem.

find inner width/height of BorderContainer component

I have a BorderContainer having top:30, bottom:5, left:2, right:2 so that it resizes with the applicaiton.
I have a custom component within it that needs to resize when the container resizes.
The problem is that getting the width and height of the container directly is not working. It seems to have a minimum width and height of 500.
Instead I have to get the width/height of its parent, which is in fact a BorderContainerSkin, then subtract the borderWeight * 2.
Is there a function that returns this?
So are you trying to manage component size inside component? It's not the Flex way. The component's parent should set its children sizes during layout. Try to set percentHeight and percentWidth (or width/height="100%") in your component.

Flex desktop application: How to position elements relative to the window size

I am creating a desktop application with Flex for the first time. I am having problems with the position and size of the elements in the screen. For instance
Elements with 100% width do not resize when the window is resized or maximized
Elements positioned relative to the bottom of the window do not move when resizing or maximizing the window
How do I solve these problems? Are there any good practices that I should follow when using Flex to develop a desktop app?
from http://nondocs.blogspot.com/2007/04/flexfaqpercentwidthpercentheight.html :
If you set percentWidth and
percentHeight of a UIComponent whose's
parent is not a Container these
properties may not effect the size of
the UIComponent. This is because
UIComponents do not actually check
percentWidth and percentHeight.
Instead the UIComponent's parent
Container checks it's childrens'
percentWidth and percentHeight and
resizes the children accordingly.
Ok, I found what I needed in Adobe's official docs... I should have looked there in the first place:
Laying Out Components
One of my problems was that I was setting the width and height of the Application, and the Flash Player does not change that parameters even if you resize its window.

Resources