1 Reply Latest reply on May 25, 2007 4:22 PM by peterent

    Changing bgColor dynamically?

    illadelphiaWeaponX
      Is it possible to use a repeater, with the dataProvider, to change backgroundColor dynamically?

      for instance:

      <mx:Repeater ........ >
      <mx:Canvas backgroundColor="{repeaterIdHere.currentItem.bg_color}" width="100%" height="100%" />
      </mx:Repeater>
        • 1. Re: Changing bgColor dynamically?
          peterent Level 2
          The Repeater will create a series of instances of the contents between <mx:Repeater> and </mx:Repeater>. For example, if you wanted 6 Canvases each with a different background color, the Repeater would work:

          [Bindable] private var dp:ArrayCollection = new ArrayCollection( [{color:0xff0000},{color:0xff8800},{color:0xffff00}, ... ]);

          <mx:Repeater id="rep" dataProvider="{dp}" >
          <mx:Canvas backgroundColor="{rep.currentItem.color}" ... >
          ...
          </mx:Canvas>
          </mx:Repeater>