Flex component setActualSize

Posted by dlots on Stack Overflow See other posts from Stack Overflow or by dlots
Published on 2012-04-01T23:16:51Z Indexed on 2012/04/01 23:29 UTC
Read the original article Hit count: 192

Filed under:
|

I am a little confused about the setActualSize method. It appears from what I've read, that if it is not called on a component by its parent, the component will not be rendered.

So it appears that setActualSize is a critical method that is directly bound to rendering the UIComponent. It also appears that the width and height properties of UIComponent override the functionality of the width and height properties of flash.display.DisplayObject, in that they are not directly bound to the rendering of the object but are virtual values that are mainly used by the getExplicitOrMeasured when the parent of the component calls the component's setActualSize method.

So the question are:

1) Why isn't the default behavior of every component to just call setActualSize(getExplicitOrMeasuredWidth(),getExplicitOrMeasuredHeight()) on itself?

2) I guess this question stems from the above question and the behavior as I understand it as described above: does setActualSize change the visibility of the component?

It appears that that the behavior is that a component is not rendered until setActualSize is called, but if it contains display object children itself (expected behavior as it can calculate measure on itself) and is added to the display list, the only reason why flash isn't rendering it, is because its not visible.

3) Relating to question #1, does updateDisplayList of UIComponent have a method that goes through its children calling setActualSize on each of them?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript