1

I'm trying to change the background color for specific dates in DataChooser. More specifically , 10 and 20 must have a different color. Here is my code, that I took this question (I cannot add comments there still):

public class FancyDateChooser extends  DateChooser {

        public var highlightColor : Number = 0xff0000;
        public var highlightDate : Array = ["10","20"];

        public function FancyDateChooser() {
            super();
        }

        protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            var dateGrid : UIComponent = mx_internal::dateGrid;
            for ( var i: int = 0; i < dateGrid.numChildren; i++ ) {
                if (dateGrid.getChildAt( i ) is IUITextField) {
                    var textField:UITextField = dateGrid.getChildAt(i) as UITextField;
                    for (var j:int = 0; j<highlightDate.length; j++) {
                        if ( textField.text == highlightDate[j] ) {
                            textField.backgroundColor = highlightColor;
                        }
                    }
                }
            }
        }

    }

It is entering the updateDisplayList method perfectly , but the background color does not change.

I have to use the updateDisplayList or invalidateDisplayList parent methods to work? I do not know how to use these methods .

Thank you.

Community
  • 1
  • 1
brunojmbq
  • 21
  • 8

0 Answers0