3 Replies Latest reply on Oct 28, 2010 4:50 AM by SiHoop

    Remove Bindable

    SiHoop Level 1

      I have an arrayCollection that is Bindable. Each time the AC is updated it triggers an event that sets off a chain of actions. I need to update the AC by looping through an array. Each time the AC updates the chain of actions is activated. What I'd like to do is temporarily deactivate the Bindable property, then re-set it when it's time to send the event. Can this be done? If not, what is a good way to update several elements of my AC at the same time? How about cloning an AC, setting the clone to the updated values then let the AC= clone AC? Is that going to mess me up if I try to add to the original AC?

        • 1. Re: Remove Bindable
          Evtim Georgiev (Adobe) Level 2

          Hi SiHoop,


          Have you tried using disableAutoUpdate() and enableAutoUpdate() on the collection? You can call disableAutoUpdate() on the collection, perform the changes, then call enableAutoUpdate(). At that poin the collection will dispatch all of the events that have been queued due to the changes you made.



          • 2. Re: Remove Bindable
            BhaskerChari Level 4

            Hi Sihoop,


            I think you can also make use of commitProperties() method and invalidation by using the boolean flags ...something like as shown below:


            private var _dataProvider : ArrayCollection;
            private var _dataProviderChanged : Boolean = false;

            public function set dataProvider( arr : ArrayCollection ) : void {
            this._dataProvider = arr;
            arr.addEventListener( CollectionEvent.COLLECTION_CHANGE,
            dataProviderChangeHandler );
            this._dataProviderChanged = true;

            override protected function commitProperties():void {
            if( this._dataProviderChanged ) {
            for each( var n : Number in this._dataProvider ) {
            var l : Label = new Label();
            l.text = n.toString();
            this.addChild( l );
            this._dataProviderChanged = false;

            private function dataProviderChangeHandler( e : Event ) : void {
            this._dataProviderChanged = true;





            • 3. Re: Remove Bindable
              SiHoop Level 1

              Excellent. Thank you.