1 Reply Latest reply on Mar 22, 2011 3:43 PM by Flex harUI

    Bindable function without event name specified

    Rockfeller07

      What is the effect of making a function Bindable in flex without specifying event name with it? I have done this is my code and it seems to be working alright without any associated event (however it does generate a warning). If I remove the binding from such functions it will does effect the code and doesnt reflect the changes if the return value from the function changes.

      Could someone explain me , how and why such Bindable function work even without any event associated with [Bindable] tag.

       

       

      Example:

       

      <mx:Image id="a" source="{getImage(1)}" useHandCursor="true" buttonMode="true" width="10" height="10" click="finalize(event)" autoLoad="true"/>

       

      [Bindable] private var _ratingSelected:int;

       

      [Bindable]

      private function getImage(value:int):String

        {

      if (value <= _ratingSelected)

      return 'images/hr/applicants/star_icon.png';

      else

      return 'images/hr/applicants/star_icon_dis.png';

        }

       

      If I remove the Bindable tag from getImage function here, the image doesnt properly get updated at  the run time.  Please note that _ratingSelected is Bindable variable here. Even though I don't have any event associated with getImage() function, making it Bindable seems to be working just alright.  Does it automatically detect changes to changes in _ratingSelected variable (which is bindable) and call the getImage function at run time? Kindly enlighten.

       

      Thanks.