Closed 2jfw closed 1 month ago
Try setting _mainGroupV.layoutData
to a new HorizontalLayoutData
with percentWidth
set to 100.0
.
Unfortunately, this did not work.
Scenario 2 changed to :
_mainGroupV = new LayoutGroup();
var verticalLayout : VerticalLayout = new VerticalLayout();
verticalLayout.horizontalAlign = HorizontalAlign.JUSTIFY;
verticalLayout.verticalAlign = VerticalAlign.MIDDLE;
_mainGroupV.layout = verticalLayout;
_mainGroupV.layoutData = new HorizontalLayoutData(100);
_mainGroupH.addChild(_mainGroupV);
The label still goes out-of-bound / IR does not react to resizing.
You probably need this too, actually:
_mainGroupH.layoutData = new HorizontalLayoutData(100);
Be sure to remove this, since it could cause conflicts (and doesn't do anything anyway):
_mainGroupH.layoutData = new AnchorLayoutData();
_mainGroupH.layoutData = new HorizontalLayoutData(100);
This is working and I see how layoutData
can affect the entire layouting process.
This will likely bring in much more light to other previous "issues" I had in the past!
Thanks Josh, much appreciated (also again for your immediate response) ! 🍻
You're welcome!
I have an issue with understanding the resize behaviour/layout within an ItemRenderer. The ItemRenderer (code below) contains two layout groups:
_mainGroupH
and_mainGroupV
._mainGroupV
contains a label withwordWrap
set to true.When the parent list gets resized, the ItemRenderer should adjust it's size automatically. This only works for one scenario (1) as the following screenshots will show:
Scenario 1:
_mainGroupV
usingHorizontalLayout
:Initial stage width: Smaller stage width:
Scenario 2: Assigning the
_mainGroupV
aVerticalLayout
with the same properties will result in this:Resizing the stage will not have the label and ItemRenderer adapt to the size as it does in scenario 1 and I don't understand why.
Here is the code for both ItemRenderers:
Diff:
Scenario 1:
Scenario 2:
Full:
Scenario 1 Working as expected (
_mainGroupV
having aHorizontalLayout
whereas I would want to use aVerticalLayout
):Scenario 2 Not Working as expected (
_mainGroupV
having aVerticalLayout
[only difference!]):My question is, why does
VerticalLayout
not adapt to the size and flow out of bounds?horizontalAlign
is set toHorizontalAlign.JUSTIFY
in both scenarios.