0 Replies Latest reply on Dec 3, 2008 5:57 AM by ljonny18

    Dynamically adding childerent containers to parent containers

    ljonny18
      Hi guys, I have stumbled on another problem :S

      I am adding containers depending on a passed object:

      Code:

      [Bindable]
      public var dashboardDP:Object =
      {item:"dashboard", children: [
      {item:"vbox", id:"vbox 1", children: [
      {item:"panel", id:"panel 1", children: [
      {item:"hbox", id:"hbox 1", children: [
      {item:"view" id:"view 1"},
      {item:"view" id:"view 2"},
      {item:"view" id:"view 3"}
      ]},
      {item:"hbox", id:"hbox 2", children: [
      {item:"view" id:"view 4"},
      ]},
      ]},
      ]},
      ]};

      I am looping through the bbject getting all the values and creating the relevant containers., My problem is adding these created containers as chideren to the previosly created parent contains in the object.

      I need to add the newly created container to the relevant parent container to that child.... but I don't know how I can store the parent that I need to add the child to in relation to the Object data provider bieng used, e.g:

      parent.addChild(container)

      Using the above object, I would need to create:
      - A VBox added to the dashboard canvas
      - A Panel needing to be added to the created VBox
      - 2 Hbox's needing to be added to the Panel
      - 3 views needing to be added to the 1st HBox created
      - 1 view needing to be added to the 2nd HBox created

      etc....

      but I don't know how to store or somehow know what partent to add what child to.

      Kind Regards,
      Jon.