8 Replies Latest reply on Jun 15, 2009 3:26 PM by Flex harUI

    Knowing the measuredWidth sooner

    K-kOo Level 1

      Hi there !

       

      In one of my components (subclass of VBox) I'm overriding the AddChild so I can add the pending child to a private list. Then I'm using this list during the UpdateDisplayList to add those child to a sub HBox component (which is display in the main component).

       

      I doing it like so (simplified version...)

      override public function addChild(child:DisplayObject):DisplayObject
      {
           displayedItems.addItem(UIComponent(child));
           invalidateDisplayList();
           return UIComponent(child);
      }
      

       

      But it's time for flex to go to updateDisplayList(), my new child is still not initiazided completely, therefore i can't use its measuredWidth.

      It works fine if i'm replacing the invalidate call by currentHBox.addChild(child). The child is correctly updated by the time my updateDisplayList is automatically called. But I would like to initialize it with just the basic functions and call updateDisplayList myself. Is it possible ?

       

      Note that i tried a lot of things before asking (validateSize, validateNow, callLater + invalidate method ...) Mastering the Flex framework workflow is definitly a hard work

       

      Thank you