1 Reply Latest reply on Oct 9, 2007 9:15 AM by peterent

    change item background color on runtime

    al7256
      Hello,,

      I have a List control in my application. How do I change its items background color on runtime?

      Thanks
        • 1. Re: change item background color on runtime
          peterent Level 2
          You need to use an itemRenderer - this is a class which will have its data property set for each record. In your itemRenderer class, override the updateDisplay function and look at the data property to determine what color to make the background.

          You can use the Flash drawing API to make a simple colored background:

          graphics.clear();
          graphics.beginFill( someColor );
          graphics.drawRect(0, 0, unscaledWidth, unscaledHeight );
          graphics.endFill();

          Put that code in your updateDisplay function where "someColor" is determined from your data.