2 Replies Latest reply on Jan 28, 2011 7:36 AM by Loic.Aigon

    Set textSelectionColor of itemrenderer in my combobox

    Loic.Aigon Adobe Community Professional

      Hi all,

       

      First of all, all apologies if this question were already discussed around. I serached and found nothing. On the web, all that I have found didn't really help.

       

      I defined an itemRenderer for a combobox

       

      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" styleName="plain" >
           <mx:Style source="styles.css" />
           
           <mx:Script>
                <![CDATA[
                     private function check():void{
                          if(data.status=='ko'){
                               lbl.styleName='ko';
                          }
                     }               
                ]]>
           </mx:Script>
           
           <mx:Label id="lbl"
                       text="{data.name}"
                       valueCommit="check()"
           />
           
      </mx:VBox>
      

       

      And then my combobox

      <mx:ComboBox itemRenderer="listItem" labelField="name" />
      

       

      I have styles the combobox component like this

      ComboBox
      {     
           font-family:"HelveticaNeueLT Pro 57 Cn";
           font-size:12;
           color:#FFFFFF;
           alternatingItemColors: #555555, #383838;
           
           rollOverColor:#F9B41F;
           selectionColor:#2D2D2D;
           textRollOverColor:white;
           textSelectedColor:#F9B41F;
      }
      

       

      Everything is fine to the exception of the textRollOverColor & textSelectedColor properties which are ignored by the itemRenderer.

      So I am looking for a way to do this.

       

      I was advised to create a custom combobox, so I did

      package custom
      {
           import mx.controls.ComboBox;
           import mx.events.DropdownEvent;
           
           public class customCombobox extends ComboBox
           {
                private var DD:ComboBox;
                
                public function customCombobox()
                {
                     //TODO: implement function
                     super();
                }
           }
      }
      

       

      But I can't get how to deal with the events (rollOver/selected) so I can style the label of the itemRenderer. I am so stuck for days on that.

      So thanks in advance to anyone who could help exiting this deadend

      Just for info, it needs to be mx only, not spark.

       

      Loic