Hi,

I try to catch a change happen for ArrayCollection,but I get follow error.

ReferenceError: Error #1069: Property myCollection not found on
changeOrder and there is no default value.

but I already have myCollection,why this happen.

Thanks

Mark


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="initApp()" >
<mx:Script>
        <![CDATA[
                import mx.controls.Alert;
                import mx.collections.ArrayCollection;  
                 import mx.binding.utils.*;     
                  
                [Bindable]
                private var myCollection:ArrayCollection =   new
ArrayCollection([{order: '1', name: 'Matthews'},{order: '2', name:
'Mark'},{order: '3', name: 'Tony'}]);
                private var myCollection1:ArrayCollection = new 
ArrayCollection();
                
                public function initApp():void{                              
              
                   BindingUtils.bindSetter(watcherListener, this,
"myCollection" , true);       
            
            }     
            
            public function  watcherListener(value:ArrayCollection):void
            {
                Alert.show ("change");
            } 
                
                
                private function finishit():void{
                        
                 
                  myCollection1 = dg1.dataProvider as ArrayCollection;          
  
                  Alert.show("ok");
                } 
                
                
        ]]>
</mx:Script>
 
        <mx:DataGrid  id="dg1" x="105" y="149" dataProvider="{myCollection}"
dragEnabled="true" dragMoveEnabled="true"
                 dropEnabled="true"   > 
                <mx:columns>
                        
                        <mx:DataGridColumn headerText="Name List" 
dataField="name" />
                 
                </mx:columns>
        </mx:DataGrid>
        <mx:Button x="105" y="359" label="save" click="finishit()"/>
        
</mx:Application> 


Reply via email to