4 Replies Latest reply on Jul 20, 2012 10:40 AM by bchalupka

    Getter is called instead of the setter

    bchalupka Level 1

      I got a simple value object and  a getter and a setter for a property:

       

      [Bindable]

      /**

      * The second gradient entry.

      */

      public function get gradientEntryB():uint {

         if (fillMode == FillMode.SOLID)

           return color;

         return _gradientEntryB;

      }

       

      /**

      * @private

      */

      public function set gradientEntryB(value:uint):void {

         _gradientEntryB = value;

      }

       

       

      If I try to set a value the setter is mistaken for the getter and nothing is set. For example:

      fillValueObject.gradientEntryB = colorPicker.selectedColor;

       

      I debugged it step by step and the getter is called and then the result of the getter is set to the new value. In this case it means that nothing is saved in my value object.

      This problem happens to me  every half year. Is there a way to fix it?

       

      In the past I added a setGradientEntryB(value:uint):void method to the class to fix it, but I think it's strange if such basic things such as getters and setters aren't working as expected.