0 Replies Latest reply on Mar 18, 2009 2:59 PM by garry.b

    Stumped by Repeater

    garry.b
      Hi,

      I'm having a problem using Repeater and wonder if someone can help. The following code snippet squares some buttons by setting height = width and works just fine:

      <mx:VBox width="100%" height="100%" >
      <mx:Repeater id="systemType" dataProvider="{dp}" >
      <mx:HBox width="100%" height="100%" >
      <mx:HBox height="100%" width="60%" verticalAlign="middle" horizontalAlign="right" >
      <mx:Canvas id="coll1" height="{coll1.width}" width="16.667%" backgroundColor="red" />
      <mx:Canvas id="coll2" height="{coll2.width}" width="16.667%" backgroundColor="red" /> <mx:Canvas id="coll3" height="{coll3.width}" width="16.667%" backgroundColor="red" />
      </mx:HBox>
      </mx:HBox>
      </mx:Repeater>
      </mx:VBox>

      Introducing a nested repeater doesn't work; the height binding expression always evaluates to 0:

      <mx:VBox width="100%" height="100%" >
      <mx:Repeater id="systemType" dataProvider="{dp}" >
      <mx:HBox width="100%" height="100%" >
      <mx:HBox height="100%" width="60%" verticalAlign="middle" horizontalAlign="right" >
      <mx:Repeater id="tag" dataProvider="{systemType.currentItem.coll}" >
      <mx:Canvas id="coll" height="{coll[systemType.currentIndex][tag[systemType.currentIndex].currentIndex].width}" width="16.667%" backgroundColor="red" />
      </mx:Repeater>
      </mx:HBox>
      </mx:HBox>
      </mx:Repeater>
      </mx:VBox>

      The binding expression is correct in that it specifies the right Canvas object but the width hasn't been set at the time the Repeater is run. Can I do this using MXML only? ActionScript?

      Thanks, Garry