1 Reply Latest reply on Jan 6, 2011 1:45 PM by Flex harUI

    What is the Flex 4 equivalent of rawChildren?

    Gregory Lafrance Level 6

      I assume the answer is, access the skin. Is this true?

       

      If so, can we access and change the skin at runtime, such as when you want to access rawChildren in Flex 3?

        • 1. Re: What is the Flex 4 equivalent of rawChildren?
          Flex harUI Adobe Employee

          I'm not sure there is an equivalent.  RawChildren is part of the container

          model in mx containers.  It allows us to represent just the content children

          as the children of the container, and still put all chrome related children

          as direct children of the same container.

           

          For example, if you had the following mxml:

                  <mx:Panel id="panel" >

                      <mx:Button id="button" />

                  </mx:Panel>

           

          Then:

              panel.numChildren == 1;

              panel.getChildAt(0).id == "button"

           

          Even though the actual Panel contained a Border as well, and:

              panel.rawChildren.numChildren == 2;

              panel.rawChildren.getChildAt(0).id == "border";

              panel.rawChildren.getChildAt(1).id == "button";

           

          In Spark, if you do:

                  <s:Panel id="panel">

                      <s:Button id="button" />

                  </s:Panel>

           

          There is only one child of the Panel, and that is its skin.  The button is

          now buried several layers deep.

           

          RawChildren was used for several other kinds of things in the past.  Folks

          used rawChildren to add their own chrome.  That should now be done by

          modifying the skin.  Folks also used rawChildren to add non-IUIComponents to

          containers.  Calling addChild() on a Spark Container is not allowed and

          generates an error.  Calling addElement() of a non-IUIComponent will also

          generate an error.  Folks now addElement a SpriteVisualElement and add

          non-IUIComponents there.