Search code examples
flex4flex3flex-spark

MX components in a spark container are null


I have a spark Group container, but all its sub-components are MX components. I need to perform some operations on the MX components when the container is initialized. I tried to put the operations in the commitProperties function, but the sub-components are still null there. I tried moving them to the childrenCreated function, but they are still null. What function can I use for working with the components? Thanks.

protected override function commitProperties():void
        {
            var defaultFinishedDate:Date=new Date();
            defaultFinishedDate.date--;
            includeFinishedDateSelector.selectedDate=defaultFinishedDate;
        }

The includeFinishDateSelector is null in this function, and thus I'm getting a run-time error. It's defined as:

<mx:DateField id="includeFinishedDateSelector" formatString="{GeneralUtils.DATE_FORMAT_STRING}" 
    enabled="{includeFinishedCheckBox.selected}" width="18%"/>

And as I said, its container is a spark Group container.


Solution

  • Thanks to whomever tried to help. In the end I solved this by changing the direct container (parent) of the MX components to a spark container (it was originally an MX container in a spark container).