11 Replies Latest reply on Nov 26, 2009 9:34 AM by Flex harUI

    Error 1009 when dragging and dropping

    80sRelic

      Hello All,

       


      I have a problem in a large application with dragging and dropping between datagrids. I created a simple example of the issue below. Basically, when I press the button I get a pop-up with 2 datagrids. When Initially try to drag an item from the source grid to the destination grid I get a serious of errors:

       


      TypeError: Error #1009: Cannot access a property or method of a null object reference.

       


      ..etc

       


      If I then try and drag and drop again, it works without error. Can anyone shed light on this? Code below:

       

      The Main App:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">

       

          <fx:Script>
              <![CDATA[
                 
                  import mx.core.FlexGlobals;
                  import mx.core.IFlexDisplayObject;
                  import mx.managers.PopUpManager;
                  import mx.managers.DragManager;
                  private var popUpManager:PopUpManager;
                  private var dragManager:DragManager;
         
                  protected function button1_clickHandler(event:MouseEvent):void
                  {
                          var largePanelWindow:IFlexDisplayObject = PopUpManager.createPopUp(FlexGlobals.topLevelApplication as DisplayObject, testDrop, true);
                          var largeSimPanelInstance:testDrop = largePanelWindow as testDrop;
                          PopUpManager.centerPopUp(largeSimPanelInstance);
                  }
              ]]>
             
          </fx:Script>

       

          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <s:Button x="546" y="59" label="Button" click="button1_clickHandler(event)"/>
      </s:Application>

       

       

      The Component:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/halo" width="400" height="300" creationComplete="creationCompleteHandler()">
         
          <fx:Script>
              <![CDATA[
                 
             
              private function creationCompleteHandler():void
              {
                  srcGrid.dataProvider = ['cat','dog','bird'];
                  destGrid.dataProvider =[];
              }
             
              ]]>
          </fx:Script>
          <s:Panel x="10" y="0" width="380" height="290">
              <mx:DataGrid id="srcGrid" dragEnabled="true" dragMoveEnabled="true" x="58" y="44">
                  <mx:columns>
                      <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
                  </mx:columns>
              </mx:DataGrid>
              <mx:DataGrid id="destGrid" dragEnabled="false" dropEnabled="true" x="226" y="44">
                  <mx:columns>
                      <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
                  </mx:columns>
              </mx:DataGrid>
          </s:Panel>
         
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
      </s:Group>

       


        • 1. Re: Error 1009 when dragging and dropping
          Flex harUI Adobe Employee

          Please supply the entire stack trace.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: Error 1009 when dragging and dropping
            80sRelic Level 1

            That would help I suppose

             

            TypeError: Error #1009: Cannot access a property or method of a null object reference.
                at mx.controls.listClasses::ListBase/hideDropFeedback()[E:\dev\gumbo_beta2\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:8510]
                at mx.controls::DataGrid/hideDropFeedback()[E:\dev\gumbo_beta2\frameworks\projects\framework \src\mx\controls\DataGrid.as:5652]
                at mx.controls.listClasses::ListBase/dragDropHandler()[E:\dev\gumbo_beta2\frameworks\project s\framework\src\mx\controls\listClasses\ListBase.as:10383]
                at flash.events::EventDispatcher/dispatchEventFunction()
                at flash.events::EventDispatcher/dispatchEvent()
                at mx.core::UIComponent/dispatchEvent()[E:\dev\gumbo_beta2\frameworks\projects\framework\src \mx\core\UIComponent.as:11749]
                at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\gumbo_beta2\frameworks\pro jects\framework\src\mx\managers\dragClasses\DragProxy.as:356]
                at mx.managers.dragClasses::DragProxy/mouseUpHandler()[E:\dev\gumbo_beta2\frameworks\project s\framework\src\mx\managers\dragClasses\DragProxy.as:601]
                at mx.managers.dragClasses::DragProxy/mouseLeaveHandler()[E:\dev\gumbo_beta2\frameworks\proj ects\framework\src\mx\managers\dragClasses\DragProxy.as:551]
                at flash.events::EventDispatcher/dispatchEventFunction()
                at flash.events::EventDispatcher/dispatchEvent()
                at mx.managers::SystemManager/mouseLeaveHandler()[E:\dev\gumbo_beta2\frameworks\projects\fra mework\src\mx\managers\SystemManager.as:3310]
                at flash.events::EventDispatcher/dispatchEventFunction()
                at flash.events::EventDispatcher/dispatchEvent()
                at mx.core::UIComponent/dispatchEvent()[E:\dev\gumbo_beta2\frameworks\projects\framework\src \mx\core\UIComponent.as:11749]
                at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\gumbo_beta2\frameworks\pro jects\framework\src\mx\managers\dragClasses\DragProxy.as:356]
                at mx.managers.dragClasses::DragProxy/dispatchDragEvent()[E:\dev\gumbo_beta2\frameworks\proj ects\framework\src\mx\managers\dragClasses\DragProxy.as:343]
                at mx.managers.dragClasses::DragProxy/mouseMoveHandler()[E:\dev\gumbo_beta2\frameworks\proje cts\framework\src\mx\managers\dragClasses\DragProxy.as:530]

             

             

            TypeError: Error #1009: Cannot access a property or method of a null object reference.
                at mx.core::UIComponent/drawFocus()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\ core\UIComponent.as:8942]
                at mx.controls.dataGridClasses::DataGridBase/showDropFeedback()[E:\dev\gumbo_beta2\framework s\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:2948]
                at mx.controls::DataGrid/showDropFeedback()[E:\dev\gumbo_beta2\frameworks\projects\framework \src\mx\controls\DataGrid.as:5622]
                at mx.controls.listClasses::ListBase/dragEnterHandler()[E:\dev\gumbo_beta2\frameworks\projec ts\framework\src\mx\controls\listClasses\ListBase.as:10293]
                at flash.events::EventDispatcher/dispatchEventFunction()
                at flash.events::EventDispatcher/dispatchEvent()
                at mx.core::UIComponent/dispatchEvent()[E:\dev\gumbo_beta2\frameworks\projects\framework\src \mx\core\UIComponent.as:11749]
                at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\gumbo_beta2\frameworks\pro jects\framework\src\mx\managers\dragClasses\DragProxy.as:356]
                at mx.managers.dragClasses::DragProxy/dispatchDragEvent()[E:\dev\gumbo_beta2\frameworks\proj ects\framework\src\mx\managers\dragClasses\DragProxy.as:343]
                at mx.managers.dragClasses::DragProxy/mouseMoveHandler()[E:\dev\gumbo_beta2\frameworks\proje cts\framework\src\mx\managers\dragClasses\DragProxy.as:530]

            • 3. Re: Error 1009 when dragging and dropping
              Flex harUI Adobe Employee

              I can't reproduce the hideDropFeedback issue.  That's a very bizarre stacktrace.  It shouldn't really be possible to end up in that situation.  Is there a specific configuration (browser, os, etc)?

               

              The second issue (drawFocus) is because your popup doesn't implement IFocusManagerContainer.  I switched the Panel and Group tags (put the Panel on the outside and the Group on the inside) and then it worked.

               

              Alex Harui

              Flex SDK Developer

              Adobe Systems Inc.

              Blog: http://blogs.adobe.com/aharui

              • 4. Re: Error 1009 when dragging and dropping
                80sRelic Level 1

                I'm not at the office at the moment but I just tried my application from a different computer and it all worked fine. My workstation (where it gives the error) does have a debug version of Flash Player, I wonder if that is why I see the error.

                • 5. Re: Error 1009 when dragging and dropping
                  mewk Level 3

                  I can confirm this error. I'm using Firefox, Windows Vista, Flash Player 10, SDK build 11250. There are two error boxes that appear when you try to drag an item on the first attempt and on successive attempts (but only if you drag over the destgrid, then back to the srcgrid and then back again to the destgrid). It's gotta be a bug, here are the stack traces:

                  TypeError: Error #1009: Cannot access a property or method of a null object reference.
                       at mx.controls.listClasses::ListBase/hideDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:8548]
                       at mx.controls::DataGrid/hideDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\DataGrid.as:5670]
                       at mx.controls.listClasses::ListBase/dragDropHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:10428]
                       at flash.events::EventDispatcher/dispatchEventFunction()
                       at flash.events::EventDispatcher/dispatchEvent()
                       at mx.core::UIComponent/dispatchEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:11826]
                       at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:355]
                       at mx.managers.dragClasses::DragProxy/mouseUpHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:580]
                       at mx.managers.dragClasses::DragProxy/mouseLeaveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:530]
                       at flash.events::EventDispatcher/dispatchEventFunction()
                       at flash.events::EventDispatcher/dispatchEvent()
                       at mx.managers::SystemManager/mouseLeaveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\SystemManager.as:3314]
                       at flash.events::EventDispatcher/dispatchEventFunction()
                       at flash.events::EventDispatcher/dispatchEvent()
                       at mx.core::UIComponent/dispatchEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:11826]
                       at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:355]
                       at mx.managers.dragClasses::DragProxy/dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:342]
                       at mx.managers.dragClasses::DragProxy/mouseMoveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:509]
                  

                  and

                  TypeError: Error #1009: Cannot access a property or method of a null object reference.
                       at mx.core::UIComponent/drawFocus()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:9008]
                       at mx.controls.dataGridClasses::DataGridBase/showDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:2954]
                       at mx.controls::DataGrid/showDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\DataGrid.as:5640]
                       at mx.controls.listClasses::ListBase/dragEnterHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:10337]
                       at flash.events::EventDispatcher/dispatchEventFunction()
                       at flash.events::EventDispatcher/dispatchEvent()
                       at mx.core::UIComponent/dispatchEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:11826]
                       at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:355]
                       at mx.managers.dragClasses::DragProxy/dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:342]
                       at mx.managers.dragClasses::DragProxy/mouseMoveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:509]
                  

                  - e

                  • 6. Re: Error 1009 when dragging and dropping
                    80sRelic Level 1

                    Ok, so far I've tried this functionality with the application I am working on with 4 systems.

                     

                    I see the error with:

                     

                    XP, Firefox, Flash Player 10, Flash Builder 4 Beta 2

                    Vista, Firefox, Flash Player 10, Flash Builder 4 Beta 2

                     

                    I do not see the error with:

                     

                    XP, Firefox, Flash Player 10

                    Vista, Firefox, IE, Flash Player 10

                     

                    So for me I get the error on systems that have Flash Builder 4 Beta 2 installed.

                    • 7. Re: Error 1009 when dragging and dropping
                      Peter deHaan Level 4

                      May be worth filing a bug at http://bugs.adobe.com/flex/ and including your test case and somebody from the QA team can take a closer look.

                       

                      I can't imagine that having Builder 4 beta 2 installed is enough to set anything off. It would more likely be different Flash Player versions or Flex SDK versions (depending on whether you compiled separately on each machine vs running the same SWF on 4 different machines).

                       

                      Peter

                      • 8. Re: Error 1009 when dragging and dropping
                        Flex harUI Adobe Employee

                        That sort of points the finger at the version of the debugger player that comes with Flash Builder beta2.  Basically, the stacktrace shows that a dragEnter event somehow called a mouseLeave handler.

                         

                        So please file a bug and we'll take a look.  You can try different versions of the debugger player if you want.

                         

                        Alex Harui

                        Flex SDK Developer

                        Adobe Systems Inc.

                        Blog: http://blogs.adobe.com/aharui

                        • 9. Re: Error 1009 when dragging and dropping
                          80sRelic Level 1

                          Thanks all, I will file a bug asap.

                          • 10. Re: Error 1009 when dragging and dropping
                            mewk Level 3

                            don't use <s:Group /> as the root of your popup; you need a container that implements IFocusManager.

                             

                            - e

                            • 11. Re: Error 1009 when dragging and dropping
                              Flex harUI Adobe Employee

                              IFocusManagerContainer

                               

                              Alex Harui

                              Flex SDK Developer

                              Adobe Systems Inc.

                              Blog: http://blogs.adobe.com/aharui