1 Reply Latest reply on Jun 10, 2010 8:01 AM by someScreenName123

    Cannot create property children on...

    someScreenName123

      Afternoon all,

      I have a Component that through metadata sets the default property to an array, this allows me when I'm using the control locally to add controls inside of the component and it adds it to a vbox so for clarity it allows me to do this

       

      <my:Component>

           <mx:button />

      </my:Component>

       

      for re-use I have taken this control out and have added it to a library, so I now reference it and add it to my control, but I keep getting the error Cannot create property children(children being the name of the array).

       

      The code I use

       

      <mx:Metadata>
              [DefaultProperty("children")]

      </mx:Metadata>

       

      protected override function commitProperties():void
                  {
                      super.commitProperties();
                     
                      if (this._childrenChanged)
                      {
                          for each(var child:DisplayObject in _children)
                              {
                                  Contents.addChild( child);
                              }
                      }
                     
                  }

       

      and this function adds the visible controls to the control called Contents ( a vbox), works fine locally have moved to a library and I get

       

      Error #1056: Cannot create property children on Components.FormLayout.
          at mx.core::Container/createComponentFromDescriptor()
          at mx.core::Container/createComponentsFromDescriptors()
          at mx.core::Container/createChildren()
          at mx.core::UIComponent/initialize()
          at mx.core::Container/initialize()
          at mx.core::Application/initialize()
          at createFollowOnJob/initialize()[C:\someproject.mxml:0]
          at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\3.2.0\frameworks\pro jects\framework\src\mx\managers\SystemManager.as:2009]
          at mx.managers::SystemManager/initializeTopLevelWindow()[C:\autobuild\3.2.0\frameworks\proje cts\framework\src\mx\managers\SystemManager.as:3234]
          at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\autobuild\3.2.0\framework s\projects\framework\src\mx\managers\SystemManager.as:3064]
          at mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.2.0\frameworks\projects\fram ework\src\mx\managers\SystemManager.as:2916]

       

       

      any ideas or links to resources most appreciated :-)

      Cheers

      Tom.