0 Replies Latest reply on Feb 24, 2008 1:31 PM by bitbitFlex

    Problems Accessing ControlBar as a Child of a Panel

    bitbitFlex
      I am currently working on an application where i dynamically create panels and add them to a VBox.
      The Panels contain one Label, one List, and one ControlBar (The ControlBar contains one Label),

      the code looks a little something like this
      I have added a VBox directly to the design view the id="mainVBox"


      var panel:Panel = new Panel();
      var label1:Label = new Label();
      var list:List = new List();
      var controlBar:ControlBar = new ControlBar();
      var label2:Label = new Label();

      label1.text = "Label 1";
      list.dataProvider = [];
      label2.text = "ControlBar Label";

      controlBar.addChild(label2);

      panel.add(label1);
      panel.add(list);
      panel.add(controlBar);

      trace(panel.numChildren); // The output for this trace is = 3
      trace(panel.getChildren()); // The output for this trace is basically the label, list, controlBar

      this.mainVBox.addChild(panel); //There is only one panel in the vBox for this example

      trace(Panel(this.mainVBox.getChildAt(0)).numChildren); // The output for this trace is = 2
      trace(Panel(this.mainVBox.getChildAt(0)).getChildren()); // The output for this trace is basically label1, list


      It would seem that adding the panel to the main display removes controlBar as a child
      So i am looking for a way to access label2 through mainVBox

      If anything was unclear please let me know i will see if i can make it a little bit more clear. If any one knows whats going on i would really appreciate the help