Did you try myText.setStyle(“backgroundColor”, ...)?
On 10/24/11 9:59 AM, "Sells, Fred" <fred.se...@adventistcare.org> wrote: I'm using a VBox as a renderer for a datagrid as shown below. I've tried every combination I can think of but I can only set the background color of the mx:TextArea in the mxml. I need to change it in the actionscript. I've tried styles and properties with no success. I'm reluctant to change wrapper or children since I had a very hard time getting it to work with a custom row height. I used HTML text so I could add some bold/font color decoration; although that requirement has dissipated. <?xml version="1.0" encoding="utf-8"?> <mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" borderThickness="0" verticalScrollPolicy="off" horizontalScrollPolicy="off" paddingBottom="0" paddingLeft="0" paddingRight="0" paddingTop="0" > <fx:Script> <![CDATA[ private var _data:Object; public static var PAYOR_COLORS:Object ={"0":"pink", "1":"lightgreen", "3":"libhtblue", "8":"yellow"}; override public function set data(value:Object):void{ _data = value; mytext.htmlText = "set data called"; if (_data==null || _data.resident__id=="0") { mytext.visible = false; }else{ mytext.visible = true; var color:String = PAYOR_COLORS[_data.payor]; if (color==null) color="black"; //mytext.backgroundColor = color; mytext.opaqueBackground = color; mytext.htmlText = _data.name; trace("colordata.name = "+color+", payor="+_data.payor); //mytext.styleName = "payor"+_data.payor; //this.setStyle("backgroundColor", "yellow"); //trace("style=payor"+_data.payor+";"); //this.setStyle("color", "green"); //background = true; trace("render "+_data.name+", "+color); } } override public function get data():Object{ return _data; } ]]> </fx:Script> <mx:TextArea id="mytext" width="100%" height="100%" useHandCursor="true" buttonMode="true" mouseFocusEnabled="false" mouseChildren="false" editable="false" verticalScrollPolicy="off" horizontalScrollPolicy="off" > <!-- <mx:htmlText > <![CDATA[Joe Bl0w <font color="#FF0000">MCD</font> <p>line2</p>]]> </mx:htmlText> --> </mx:TextArea> <!-- sample use from web <![CDATA[ Joe Blw <font color="#FF0000">HTML text</font> in a <b>Halo TextArea control</b>. <p>Use the <u>htmlText property</u> of the <font color="#008800">TextArea control</font> to include basic HTML markup in your text. ]]> --> </mx:VBox> -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui