2 Replies Latest reply on Aug 31, 2009 12:44 PM by Jake Lyman

    Target ComboBox label color on MouseOver or RollOver

    Jake Lyman

      I am having a hard time figuring out how to change the label color of a combobox on rollover prior to clicking the combobox to make a new selection. I understand how to set the color of the label, how to change the textRollOverColor, textSelectedColor, etc, but setting the current label color for a combobox is stumping me.

       

      Thanks in advance.

        • 1. Re: Target ComboBox label color on MouseOver or RollOver
          babo_ya Level 3

          I'm not sure how this could be done using style tag.. if possible then ignore this solution..

           

          Well, you need a custom ComboBox that extends from the base ComboBox.. as below..

           

          package src

          {

           

           

          import flash.events.MouseEvent;

           

          import mx.controls.ComboBox;

           

          public class ExtendedCombo extends ComboBox

          {

           

           

          public function ExtendedCombo()

          {

          super();

          }

           

          protected override function createChildren():void

          {

          super.createChildren();

           

           

          textInput.addEventListener(MouseEvent.ROLL_OVER, onTextMouseOver);

          textInput.addEventListener(MouseEvent.ROLL_OUT, onTextMouseOut);

           

          }

          private function onTextMouseOver(event:MouseEvent):void

          {

          textInput.setStyle("color", "0xff0000");

           

           

           

          }

          private function onTextMouseOut(event:MouseEvent):void

          {

          textInput.setStyle("color", "0x0B333C");

          }

           

          }

          }

           

          hope this helps,

           

          BaBo,

          • 2. Re: Target ComboBox label color on MouseOver or RollOver
            Jake Lyman Level 1

            Thanks for taking the time to respond, BaBo.

             

            This is exactly what I needed.

             

            Jake