12 Replies Latest reply on Jul 7, 2011 6:40 AM by UbuntuPenguin

    Event binding on getter/setter function

    Vincent-ZHANG Level 1

      I found this snippet of code when I walked through a Flex3.6 project:

       

       

                      [Bindable(event='currentPageChanged')]
                public function get currentPage ():int {
                     return this._currentPage;
                }
                
                protected function set _currentPage (value:int):void {
                     if (this._currentPage == value){
                          return;
                     }
                     this.__currentPage = value;
                     this.dispatchEvent(new Event(BookEvent.CURRENTPAGE_CHANGED));
                }
      
                protected function get _currentPage ():int {
                     return this.__currentPage;
                }

       

       

       

      what is it meant to do by declaring a bindable event above the getter function immediately???

       

      Thanks a lot.