7 Replies Latest reply on Sep 18, 2009 1:03 AM by _Natasha_

    Bindable - dispatchEvent problem

    lukasnemecek

      Hi, I have following code:

       

      override protected function createChildren():void {

      ...

         var selectBut:Button = new Button();
         selectBut.enabled = isDataAvailable;

      ....

      }

       

      private var _isDataAvailable:Boolean = false;

      [Bindable(event="isDataAvailableEvent")]
      public function get isDataAvailable():Boolean {
                   return _isDataAvailable;
      }

      public function set isDataAvailable(b:Boolean):void {
         _isDataAvailable = b;
         dispatchEvent(new Event("isDataAvailableEvent"));
      }

       

      I want to change enabled property of button when isDataAvailable changes. When button is created, enabled is false, because isDataAvailable is false. But then I change isDataAvailable to true, _isDataAvailable is set to true and event is dispatched, but "get isDataAvailable()" is not called and selectBut.enabled is not changed to true.

       

      Please, any ideas, where the problem could be? Thank you.