1 Reply Latest reply on Dec 12, 2006 6:03 AM by peterent

    creating a ControlBar in createChild()

    bhleonard
      Creating a ControlBar instance in a Panel subclass's createChildren() function causes the ControlBar to be both layed out and styled incorrectly, even if it's the last child added. The MXML tag works as advertized. Is this a bug or am I missing something? I'd just use the tag and be done with it, but programming with xml tags gives me heartburn.
        • 1. Re: creating a ControlBar in createChild()
          peterent Level 2
          I'm afraid the ControlBar is given preferential treatment when it is included as MXML. The easiest way to deal with this is to make your own Panel class (MyPanel.mxml) which includes the ControlBar. Then you don't have to worry about it any longer.

          Since the ControlBar is considered a child of the Panel, if were to then do:

          <MyPanel...>
          <mx:Button label="Some Button" />
          </MyPanel>

          You will get an error saying that the Panel already has children. Take a look at this article on my blog about composing a template component: March 27, 2006