Search code examples
apache-flexactionscriptlifecycle

Where to put layout code


I need some code to run in a component after all the sizes of its children are known. The component has an absolute layout. I thought my component's measure() function would get called after all it's children's measure() functions had been called, but it seems like since it has an absolute layout, it never even calls measure.

Anyways, it's a Canvas and my override protected function measure():void never runs. What am I doing wrong?


Solution

  • updateDisplayList() is called in UIComponent's commitProperties. I believe this is called after the child sizes are known, and it is where you are supposed to put your layout code.

    measure() is not called when you explicitly set a width and height on your components. If you have an absolute layout on your Canvas, but do not set a width and height, measure() will be called.

    HTH;

    Amy