11 Replies Latest reply on Jul 9, 2009 8:31 AM by injpix

    Bizarre Error

    istrasci

      Here's what I'm trying to do...  I have a List whose source is an ArrayCollection populated with objects, and the list displays one of the object's string members for the label...  Then, I have a DataGrid (one column) that will accept the objects from the list to be drag-n-dropped...  I've set up the dragging and dropping elements properly for both...  My problem is that when I go to drag an item from the list, I get this very obscure error:

       

      "ArgumentError: Error #2004: One of the parameters is invalid.

            ... <rest of stack trace>"

       

      Now, I did some searching about this error and found out it's something to do with a remote call not correctly (un)marshalling the object...  The problem is, I'm not doing anything with remote objects here...  So I have no idea what's going on...

       

      If I prepopulate the list's dataProvider with these objects in a for-loop at in the components init() method (creationComplete handler), it works just fine...  But as soon as I change it to be populated dynamically with user-entered data, it starts giving me this error...  Does anybody know 1) why I would be getting this error when not working with remote objects, 2) why it would only happen when dynamically populating the list, and 3) how I mix fix / work-around this...?  -ANY- help would be greatly appreciated...

       

           - Ian

        • 1. Re: Bizarre Error
          injpix Level 3

          Post the rest of your stack trace, that should point to a method which may be the cause.  It seems that there is a method that gets invoked when the user drags and drops an itemrenderer that may have an incorrect number of parameters or incorrect data type.  Is this object strong-typed in the ArrayCollection?  If so, is this method expecting that data type for its argument?

          • 2. Re: Bizarre Error
            istrasci Level 1

            Here's the rest of the stack trace:


            ArgumentError: Error #2004: One of the parameters is invalid.
                at flash.utils::ByteArray/writeObject()
                at flash.desktop::Clipboard/putSerialization()
                at flash.desktop::Clipboard/convertFlashFormat()
                at flash.desktop::Clipboard/setData()
                at mx.managers::NativeDragManagerImpl/doDrag()[C:\autobuild\3.2.0\frameworks\projects\airfra mework\src\mx\managers\NativeDragManagerImpl.as:282]
                at mx.managers::DragManager$/doDrag()[C:\autobuild\3.2.0\frameworks\projects\framework\src\m x\managers\DragManager.as:243]
                at mx.controls.listClasses::ListBase/dragStartHandler()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:9085]
                at flash.events::EventDispatcher/dispatchEventFunction()
                at flash.events::EventDispatcher/dispatchEvent()
                at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
                at mx.controls.listClasses::ListBase/mouseMoveHandler()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:8822]

             

            The problem is, is doesn't point to any method that I'm calling...  I've researched some more and found some other instances where this happened with drag-n-drop, such as this one:https://bugs.adobe.com/jira/browse/SDK-13486;jsessionid=B5AA66B06BA7F55A1E0FD9721CB1C0D2

             

            It gives some suggestions, but 1) I'm not sure how to implement them, and 2) what I tried doesn't solve anything...  Again, it's strange to me that the app. would run fine when the array is populated programmatically, but when it's done dynamically by the user, -THEN- it breaks...

             

            Here's the component file too

            • 3. Re: Bizarre Error
              istrasci Level 1

              Here's the rest of the stack trace:

               

              ArgumentError: Error #2004: One of the parameters is invalid.
                  at flash.utils::ByteArray/writeObject()
                  at flash.desktop::Clipboard/putSerialization()
                  at flash.desktop::Clipboard/convertFlashFormat()
                  at flash.desktop::Clipboard/setData()
                  at mx.managers::NativeDragManagerImpl/doDrag()[C:\autobuild\3.2.0\frameworks\projects\airfra mework\src\mx\managers\NativeDragManagerImpl.as:282]
                  at mx.managers::DragManager$/doDrag()[C:\autobuild\3.2.0\frameworks\projects\framework\src\m x\managers\DragManager.as:243]
                  at mx.controls.listClasses::ListBase/dragStartHandler()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:9085]
                  at flash.events::EventDispatcher/dispatchEventFunction()
                  at flash.events::EventDispatcher/dispatchEvent()
                  at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
                  at mx.controls.listClasses::ListBase/mouseMoveHandler()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:8822]

               

              There problem is, is that it doesn't point to any of my methods...  I did some more research on this error, and it seems to appear commonly with drag-n-drop...  I found this post too...  https://bugs.adobe.com/jira/browse/SDK-13486;jsessionid=B5AA66B06BA7F55A1E0FD9721CB1C0D2

               

              They have a suggestion, but 1) I'm not sure how to implement what they're talking about, and 2) the things I -have- tried don't solve anything...  It's just weird to me that my app. would work fine when the list's dataprovider is populated programmatically, but it breaks when populated dynamically by the user...

               

              Here's the component's file attached as well...

              • 4. Re: Bizarre Error
                istrasci Level 1

                Here's the rest of the stack trace:

                 

                 

                ArgumentError: Error #2004: One of the parameters is invalid.
                    at flash.utils::ByteArray/writeObject()
                    at flash.desktop::Clipboard/putSerialization()
                    at flash.desktop::Clipboard/convertFlashFormat()
                    at flash.desktop::Clipboard/setData()
                    at mx.managers::NativeDragManagerImpl/doDrag()[C:\autobuild\3.2.0\frameworks\projects\airfra mework\src\mx\managers\NativeDragManagerImpl.as:282]
                    at mx.managers::DragManager$/doDrag()[C:\autobuild\3.2.0\frameworks\projects\framework\src\m x\managers\DragManager.as:243]
                    at mx.controls.listClasses::ListBase/dragStartHandler()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:9085]
                    at flash.events::EventDispatcher/dispatchEventFunction()
                    at flash.events::EventDispatcher/dispatchEvent()
                    at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
                    at mx.controls.listClasses::ListBase/mouseMoveHandler()[C:\autobuild\3.2.0\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:8822]

                 


                There problem is, is that it doesn't point to any of my methods...  I did some more research on this error, and it seems to appear commonly with drag-n-drop...  I found this post too...  https://bugs.adobe.com/jira/browse/SDK-13486;jsessionid=B5AA66B06BA7F55A1E0FD9721CB1C0D2

                 


                They have a suggestion, but 1) I'm not sure how to implement what they're talking about, and 2) the things I -have- tried don't solve anything...  It's just weird to me that my app. would work fine when the list's dataprovider is populated programmatically, but it breaks when populated dynamically by the user...

                 


                OK, stupid forum is not letting me upload...

                • 5. Re: Bizarre Error
                  injpix Level 3

                  Yeah, this forum still has issues uploading content.

                   

                  This issue you're having is new to me.  But it seems from that Jira link you posted, you need to register the class with an alias name, via registerClassAlias().  I searched "registerClassAlias"in Google and the first few links seem to resolve the issue that you're having.

                   

                  Look at the livedoc on it here:

                  registerClassAlias()

                   

                   

                  Does that help?

                  • 6. Re: Bizarre Error
                    istrasci Level 1

                    I tried (many combinations) of the following:

                     

                    registerClassAlias('mx.controls.listClasses.ListBase', mx.controls.listClasses.ListBase);
                    registerClassAlias('mx.managers.DragManager', mx.managers.DragManager);
                    registerClassAlias('flash.utils.ByteArray', flash.utils.ByteArray);
                    registerClassAlias('flex.messaging.io.ArrayCollection', mx.collections.ArrayCollection);
                    registerClassAlias('components.ChainOfCustody', components.ChainOfCustody);

                     

                    They didn't do anything helpful, but I'm not sure if I'm even registering the right class...

                    • 7. Re: Bizarre Error
                      injpix Level 3

                      You posted previously, "Here's the component file too".  Is this component that the user drags-and-drops?  If so, that is what you want to pass in registerClassAlias().  When you have passed the component into the registerClassAlias(), test it the same as in the livedocs:

                       

                                  registerClassAlias("com.example.eg", ExampleClass);
                                  var eg1:ExampleClass = new ExampleClass();
                                  var ba:ByteArray = new ByteArray();
                                  ba.writeObject(eg1);
                                  ba.position = 0;
                                  var eg2:* = ba.readObject();
                                  trace(eg2 is ExampleClass); // true
                      

                       

                      And it should return true, just as above.

                      • 8. Re: Bizarre Error
                        istrasci Level 1

                        Yeah, the component is ChainOfCustody and it is what the user is dragging...  Actually, to be more precise, the ArrayCollection that is the source of the draggable List contains these objects...  And here is the register I have:

                         

                        registerClassAlias('components.ChainOfCustody', components.ChainOfCustody);

                         

                        I tested it out (as per your last post) and it indeed returns true, but the error persists...

                        • 9. Re: Bizarre Error
                          injpix Level 3

                          Hmm...have the alias name different then fully qualified name.  Such as:

                           

                          registerClassAlias('components.coc', components.ChainOfCustody);

                           

                          Also are you sure registerClassAlias() is called before any drag and drop happens?


                          • 10. Re: Bizarre Error
                            istrasci Level 1

                            Yes, I'm doing the register in my app's creationComplete handler.  But even changing the alias string doesnt work.  I think I'm about to give up on this until my Flexpert friend comes into town...

                            • 11. Re: Bizarre Error
                              injpix Level 3

                              Yeah, let us know if you find a solution.  I am not sure what else to suggest.