1 Reply Latest reply on Apr 1, 2012 11:35 PM by Flex harUI

    Flex component setActualSize

    imagenesis media Level 1

      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?

        • 1. Re: Flex component setActualSize
          Flex harUI Adobe Employee

          In Flex, parents size their children.  SetActualSize (or setLayoutBoundsSize) is recommended since it does not set the explicitWidth/Height and therefore prevent the component from responding to new measurements.

          Many parents don’t use getExplicitOrMeasuredWidth/Height because some other layout rule actually dictates the size (like percentWidth/Height or the left/right/top/bottom properties).


          UpdateDisplayList() is where a component should modify any children to set up the display list for that component.  IOW, that’s where the component sizes its children.  But the call can be delegated to a replaceable layout in Spark and a few other places.