8 Replies Latest reply on Apr 6, 2011 11:23 PM by Charan Raj

    need input on laying out spark groups at runtime

    Charan Raj Adobe Employee

      Hi,

       

      i have this problem and need some inputs on how to address it

       

      i have two spark groups and each have some children in them. i want to arrange these two groups in particular order.

      like

       

      <s:Group id="mainContainerGroup>

       

      <s:layout>

      <s:BasicLayout />

      </s:layout>

       

      <s:Group id="g1">

      <s:Image id="b1_g1">

      <s:Image id="b2_g1">

      <s:Image id="b3_g1">

      </s:Group>

       

      <s:Group id="g2">

      <s:Image id="b1_g2">

      <s:Image id="b2_g2">

      <s:Image id="b3_g2">

      </s:Group>

       

      </s:Group>

       

       

      during runtime, i layout g1 at some position and i want g2's top to coincide with g1's bottom

       

      i am laying out g1 and its children in following manner

       

      g1.top = 0;

      b1_g1.top = 0;

      b2.g1.top = b1_g1.top + b1_g1.height;

      b3.g1.top = b2_g1.top + b2_g1.height;

       

       

      now, its time to layout g2 group, when i do this -

       

      g2.top = g1.top + g1.width;

       

      i dont get correct behavior, the g1.width value doesnt seem to be appropriate.

       

       

      i kind of have one working solution at hand - which is based on location of last element of g1

       

      g2.top = b3_g1.top + b3_g1.width;

       

      but this is not an ideal solution because if i keep appending new children to g1 then i need to make sure to update the g2.top accordingly, basically maintenance problem.

       

      could you please let me know how do one tackle such problem ?

       

      thanks,