1 Reply Latest reply on Jan 1, 2011 2:34 PM by Shongrunden

    Binding in Flex 4

    Zolotoj Level 3

      I need some help understanding how binding is working in Flex 4.

      Here is some code:

      BindingUtils.bindProperty(general, "division", divisions, "dataToSelectedIndex");


      where general is an object with a public property "division".


      Divisions is a dropdownlist with the following definition:

      package modulecode
           import flash.events.Event;
           import spark.components.DropDownList;
           public class formDropDownList extends DropDownList
                public function formDropDownList()
                public function set dataToSelectedIndex(keyValue:int):void
                     if (keyValue == 0)
                          selectedIndex = -1;
                          for (var i:int=0;i<dataProvider.length;i++)
                               if (Number(dataProvider[i]["id"].toString()) == keyValue)
                                    selectedIndex = i;
                public function get dataToSelectedIndex():int
                     return selectedIndex;

      Somewhere ein the code I have this code:

      divisions.dataToSelectedIndex = 10;


      what I dont understand is why after this code divisions' getter is not called when dataToSelectedIndex has been changed.


      Please help.