In practice, itemRenderers actually tend to be the best candidate for skins.

-TH

--- In flexcoders@yahoogroups.com, Alex Harui <aharui@...> wrote:
>
> You cannot set the backgroundColor of the renderer.  Backgrounds are removed 
> in order to allow alternating background colors to show through.  But you 
> should be able to set it on the TextArea.
> 
> 
> On 10/24/11 6:40 PM, "Sells, Fred" <fred.sells@...> wrote:
> 
> 
> 
> 
> 
> 
> Yes I tried setStyle() as well as styleName= with no success.  I could not 
> set the backgroundColor property in actionscript (compiler did not recognize 
> property) but I could set that property in mxml to a binding expression and 
> set the color in the bound variable.  Suspect bug but deadlines rapidly 
> approaching and this works.
> 
> I'll try upgrading to 4.5 once I get this delivery out.
> 
> 
> From: flexcoders@yahoogroups.com [mailto:flexcoders@yah! oogroups.com] On 
> Behalf Of Alex Harui
> Sent: Monday, October 24, 2011 7:41 PM
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Flex 4.1 VBOX background renderer fails
> 
> 
> 
> Did you try myText.setStyle("backgroundColor", ...)?
> 
> 
> On 10/24/11 9:59 AM, "Sells, Fred" <fred.sells@...> 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
> actionscri! pt.  I've tried styles and properties with no success. &n! 
> bsp;I'm< br>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():Objec! t{
> re turn _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
>


Reply via email to