I’d like to get the actual height of a component after adding some children.
When inspecting the variables tab in debug mode, I see 2 different height variables:
$height (which contains the correct value: 138) and height/_height (which contains a wrong value: 10).
I guess that the display is not updated and so I’m not getting the correct height using component.height, but how can I get the value in $height?
Thanks for any help you can provide =)
Regards,
BS_C3
@Flextras
Again, thanks a lot for your answer! That was really detailed =)
Measuredheight is not giving me the value I’m looking for, and explicitHeight has no value (NaN). I cannot test right now, so I can’t tell for unscaledHeight…
Here’s the structure of what I have:
MainContainer - Canvas
BOX1 - Canvas (height = 100)
BOX2 - Canvas (height = 100)
VariableBox - Canvas (height: depends on the height of it's variable number of children)
Text - TextArea
I need the VariableBox’s height in order to position Text.
The function looks like this:
updateDisplay(){
for(i;i<list.length;i++){
VariableBox.addChild(new HBox);
}
// reposition Text depending on VariableBox's height
}
I know I’m not giving any code but I’m not on my working computer right now >_<
Hope this helps!!
Final solution:
I finally found some workaround that’s satisfying for me without doing some extravagant stuff…
I had a parent container to which I was dynamically adding some children, and it’s height wasn’t getting updated. The issue I was having is that neither measuredHeight, nor explicitHeight, nor height, nor unscaledHeight of the parent container were giving me the height I needed when I wanted it.
So, I added a listener to the creationComplete of each child. Once the creation complete event is launched, every control of the child is taken into account. At this moment, the measuredHeight of the parent container is set to the expected value. So I just needed to set:
Thanks again to Flextras who has given some useful information =)
Regards.