Hi Mark,

Try something like this:  (make sure that your itemRenderer is a
container that supports the backgroundColor style property.  You can
change the text color this way as well, using "color".

override public function set data(value:Object):void
{
     super.data = value;

     if( value != null )
     {
         if ( value.myProperty == "myCondition" )
         {
             this.setStyle("backgroundColor","red");
         }
         else
         {
              this.setStyle("backgroundColor","#FFFFFF");
         }

         super.invalidateDisplayList();
     }
}

-TH
__________________________________

Tim Hoff
Cynergy Systems, Inc.
http://www.cynergysystems.com
Office <http://www.cynergysystems.comoffice/> : 866-CYNERGY

--- In flexcoders@yahoogroups.com, "Mark" <[EMAIL PROTECTED]> wrote:
>
> I need to change the background color of some items in the
> HorizontalList. I thought the easiest way would be to create an
> itemRenderer such as below. But I can't change the color this way.
> Does anyone know what the problem is here? The setColor function
> will have much more to it once I get the setStyle to work.
>
> Thanks
>
> ## In the Application##
> <mx:HorizontalList id="hl" width="100%" height="50"
> dataProvider="{hListArray}" columnWidth="125" showScrollTips="true"
> scrollTipFunction="myScrollFunction" selectable="false"
> itemRenderer="com.radar.HListRenderer" />
>
> ## ItemRenderer ##
> <?xml version="1.0" encoding="utf-8"?>
> <mx:TextArea xmlns:mx="http://www.adobe.com/2006/mxml";
> creationComplete="setColor()">
> <mx:Script>
> <![CDATA[
> public var newColor:Number;
> public function setColor():void {
> trace("changing");
> this.setStyle("Color", 0xFF0000);
> }
> ]]>
> </mx:Script>
> </mx:TextArea>
>


Reply via email to