1 Reply Latest reply on Mar 21, 2011 2:59 PM by rtalton

    Assigning property value using ActionScript in MXML

    hitenjava123

      I have a component extending VBox, say MyContainer. I have an array property, say myArray.
      I am trying to set myArray using a function.

       


      If I do something like :

       

      <MyContainer >
          <myArray>
              <mx:Array>
                  <obj/>
              </mx:Array>
          </myArray>
      <MyContainer>

       

      then it works fine. The setter for 'myArray' is called.

       


      But, if I do something like this:

       

      <MyContainer myArray="{buildArray()"}>

       

          <mx:Script>
              <![CDATA[

       

                  public function buildArray():Array {
                      return [obj];
                  }

       

              ]]>
          </mx:Script>

       

      <MyContainer>

       

      In this case, the setter for 'myArray' never gets called.

       


      I want to check the value of 'myArray' before the container is added is initialized.
      Any suggestions?