6 Replies Latest reply on Oct 4, 2010 2:13 AM by dtx_flex4

    ArrayList removeItem issue

    dtx_flex4 Level 2

      Hi.

       

      I have strange problem. I trying delete object from ArrayList by removeItemAt(0), but that error shows up: "Parameter name must be non-null".

      But when I do removeAll that error not occur. Also that index is there for sure becouse when i type getItemAt(0) the object was returned.

       

      Where is problem? : (

        • 1. Re: ArrayList removeItem issue
          Anitha Selvaraj Level 2

          Can you post your code


          • 2. Re: ArrayList removeItem issue
            dtx_flex4 Level 2

            The code is long, but with array I do few steps:

             

            [Bindable] public var imgListArray:ArrayList;

            imgListArray = new ArrayList();

             

            then i push new Object to them:

            imgListArray.addItem(new ObjectProxy(objectName));

             

            I succesful retrive data from this Array via List component. In this component i have extra button where is action to delete this item:

            var indexNumber:Number = outerDocument.imgListArray.getItemIndex(data) // this work and returns good item index

            outerDocument.imgListArray.removeItemAt(indexNumber); // i can switch indexNumber to 0 and still not working (Error #2007: Parameter name must be non-null)

             

            Hmm?

            • 3. Re: ArrayList removeItem issue
              Flex harUI Adobe Employee

              Is there a callstack with the error.

              • 4. Re: ArrayList removeItem issue
                dtx_flex4 Level 2

                Yep - there is a error stack:

                 

                TypeError: Error #2007: Parameter name must be non-null.
                    at flash.display::DisplayObject/set name()
                    at mx.binding::Binding/defaultDestFunc()[E:\dev\4.x\frameworks\projects\framework\src\mx\bin ding\Binding.as:270]
                    at Function/http://adobe.com/AS3/2006/builtin::call()
                    at mx.binding::Binding/innerExecute()[E:\dev\4.x\frameworks\projects\framework\src\mx\bindin g\Binding.as:475]
                    at Function/http://adobe.com/AS3/2006/builtin::apply()
                    at mx.binding::Binding/wrapFunctionCall()[E:\dev\4.x\frameworks\projects\framework\src\mx\bi nding\Binding.as:385]
                    at mx.binding::Binding/execute()[E:\dev\4.x\frameworks\projects\framework\src\mx\binding\Bin ding.as:321]
                    at mx.binding::Binding/watcherFired()[E:\dev\4.x\frameworks\projects\framework\src\mx\bindin g\Binding.as:501]
                    at mx.binding::Watcher/notifyListeners()[E:\dev\4.x\frameworks\projects\framework\src\mx\bin ding\Watcher.as:311]

                    [...]

                    at mx.collections::ArrayList/internalDispatchEvent()[E:\dev\4.x\frameworks\projects\framewor k\src\mx\collections\ArrayList.as:673]
                    at mx.collections::ArrayList/removeItemAt()[E:\dev\4.x\frameworks\projects\framework\src\mx\ collections\ArrayList.as:491]

                 

                     (it is beginning from my delete function)

                 

                Any ideas?

                • 5. Re: ArrayList removeItem issue
                  dtx_flex4 Level 2

                  or in better way:

                  appName [Desktop Application]   
                      file:/C:/path/to/app   
                          Main Thread (Suspended: TypeError: Error #2007: Parameter name must be non-null.)   
                              mx.binding::Binding/watcherFired   
                              mx.binding::Watcher/notifyListeners   
                              mx.binding::PropertyWatcher/eventHandler   
                              flash.events::EventDispatcher/dispatchEventFunction [no source]   
                              flash.events::EventDispatcher/dispatchEvent [no source]   
                              mx.core::UIComponent/dispatchEvent   
                              spark.components::DataRenderer/set data   
                              spark.components::DataGroup/http://www.adobe.com/2006/flex/mx/internal::itemRemoved   
                              spark.components::DataGroup/adjustAfterRemove   
                              spark.components::DataGroup/http://www.adobe.com/2006/flex/mx/internal::dataProvider_collectionChangeHandler   
                              flash.events::EventDispatcher/dispatchEventFunction [no source]   
                              flash.events::EventDispatcher/dispatchEvent [no source]   
                              mx.collections::ArrayList/internalDispatchEvent   
                              mx.collections::ArrayList/removeItemAt   
                              appNameInnerClass0/myDeleteFunc
                              appNameInnerClass0/__myDeleteFuncButton_click

                  • 6. Re: ArrayList removeItem issue
                    dtx_flex4 Level 2

                    Ok. I figured out.

                    In my custom itemRender i used for attribute "name" data from this object.

                    (It's so obvius!)

                     

                    Anyway thanks for helping.