11 Replies Latest reply on Jan 13, 2007 4:44 AM by Dr Khaled

    TypeError: Error #1009:

    KomputerMan.com Level 1
      I just upgraded to Flex 2.0.1 and am now getting errors when I select something from a datagrid. I didn't have this problem with the application when I was running Flex 2.0.0. Here is the error message I am getting...

      TypeError: Error #1009: Cannot access a property or method of a null object reference. at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::mouseIsUp()

      [C:\dev\flex_201_gmc\sdk\frameworks\mx\controls\listClasses\ListBase.as:7029] at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::mouseUpHandler()

      [C:\dev\flex_201_gmc\sdk\frameworks\mx\controls\listClasses\ListBase.as:7060] at mx.controls::DataGrid/mx.controls:DataGrid::mouseUpHandler()

      [C:\dev\flex_201_gmc\sdk\frameworks\mx\controls\DataGrid.as:4211]

      The problem is when I run this using the debugger I don't see an error in any of my code. I see the error appear in the DatGrid.as module that Adobe provided. Any ideas on how I try to debug this problem???

      The way my code works is that I have a datagrid to select a person and some associated data from my database. After I select the person I change my view states to a Tab Navigator control. Like I mentioned earleir I get the error message before the tab navigator appears but after all of my own code executes.

      Any help at all would be appreciated!!!

      Have an Ordinary Day...
      KomputerMan ~|:-)
        • 1. Re: TypeError: Error #1009:
          KomputerMan.com Level 1
          Part II of the error. I found the portion of the code in the DataGrid.as file that fails. The function called that fails is called:
          override protected function mouseUpHandler(event:MouseEvent):void

          The section of code that fails begins on line 4211.

          When in debug mode and I hit the Step Over command on the following line I get the error message:

          super.mouseUpHandler(event);


          Adobe??? Why would this function fail now???

          Have an Ordinary Day...
          KomputerMan ~|:-)
          • 2. Re: TypeError: Error #1009:
            KomputerMan.com Level 1
            Error Part III

            O.K. A little further into the error now... I did a Step Into the Super.mouseUpHandler(event); and found the line in the handler that caused the error..

            The line code that fails is in the ListBase.as template beginning on line 7026.

            private function mouseIsUp():void
            {
            systemManager.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true);
            stage.removeEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);

            if (!dragEnabled && dragScrollingInterval != 0)
            {
            clearInterval(dragScrollingInterval);
            dragScrollingInterval = 0;
            }
            }

            The first line in this function is what fails:
            systemManager.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true);

            Have an Ordinary Day...
            KomputerMan ~|:-)

            • 3. Re: TypeError: Error #1009:
              FlightGuy Level 1
              I encountered the same problem after upgrading. I'm assuming that you are closing the datagrid in the event handler - in my case I had a popup window, and in the change event handler I did a PopUpManager.removePopUp(this).

              I think it is a bit of a bug, but the workaround is to close the datagrid using callLater. So, in my example, I did something like:

              callLater(PopUpManager.removePopUp, [this]);

              That way the datagrid gets to process its mouseUp before the object is removed.

              Tim
              • 4. Re: TypeError: Error #1009:
                KomputerMan.com Level 1
                I'm not really closing my datagrid I am changing view states. Really all I am doing is taking the selected item from the datagrid and sending it to other view state as an object. I think it is a bit of a bug too but I am not sure what to call later in this instance... Not only that but I am pretty impressed that you even knew about the callLater and how to use it to solve your problem. I can now think of a place or two where that might help me too!!!

                Have an Ordinary Day...
                KomputerMan ~|:-)
                • 5. Re: TypeError: Error #1009:
                  FlightGuy Level 1
                  When you change your state, instead of using the assign to currentState, try this:

                  callLater(setCurrentState, ["myNewState"]);

                  Tim
                  • 6. Re: TypeError: Error #1009:
                    KomputerMan.com Level 1
                    Tim... Thanks for the help... It is getting closer but not quite there yet. Now I only get an error the first time I select something from the datagrid. After that I can return to the datagrid and make other selections and they all work fine. I am not sure if it is the sequencing of the calls in the functions or not.

                    Here is the code I am using when I select something from the datagrid. The first half of the function returns a bunch of data associated with the person I selected from the data grid. The rest of the function just performs some setting up of the other pages (14 total forms called from two tab navigators) in the application.

                    private function claimantSelHandler(event:KDL_SelEvent):void
                    {
                    selectedClaimant = new Object;
                    selectedClaimant = event.KDL_SelObject; // Returns the selected person

                    my2ndClaimData = new ArrayCollection([
                    {label:"ClaimCnt", data:selectedClaimant.ClaimCnt},
                    {label:"ClaimNum", data:selectedClaimant.ClaimNum}
                    ]);


                    getSelClaim.GetClaimInfo(selectedClaimant.ClaimCnt,selectedClaimant.ClaimNum); // Calls for the selected persons claim data
                    getSelClaim.GetAppealInfo(selectedClaimant.ClaimNum); // Calls for the selected persons Appeal data
                    getSelClaim.GetICInfo(selectedClaimant.ClaimNum); // Calls for the selected persons IC data
                    getSelClaim.GetTaskInfo(selectedClaimant.ClaimNum); // Calls for the selected persons Task data
                    getSelClaim.GetNotesInfo(selectedClaimant.ClaimNum); // Calls for the selected persons Notes data
                    getSelClaim.GetAttyInfo(selectedClaimant.ClaimNum); // Calls for the selected persons Attorney data
                    getSelClaim.GetTransInfo(selectedClaimant.ClaimNum); // Calls for the selected persons Transaction data

                    getSelClaimant.GetDepInfo(selectedClaimant.ClaimCnt); // Returns all of the Dependant information
                    getSelClaimant.GetImpairments(selectedClaimant.ClaimCnt); // Returns all of the Impairment information
                    getSelClaimant.GetEmpInfo(selectedClaimant.ClaimCnt); // Returns all of the Employment information
                    getSelClaimant.GetHistInfo(selectedClaimant.ClaimCnt); // Returns all of the Historical (Unknown Fields) information

                    callLater(setCurrentState, ["ClaimNav"]);
                    // currentState='ClaimNav';

                    depInfoID.setStatus();
                    depInfoID.Input_ClaimCnt.text=selectedClaimant.ClaimCnt;
                    depInfoID.statusLabel.visible = false;
                    depInfoID.addDepButton.visible = false;
                    depInfoID.modDepButton.visible = false;
                    depInfoID.delDepButton.visible = false;
                    impairmentID.setStatus();
                    impairmentID.statusLabel.visible=false;
                    impairmentID.Input_ClaimCnt.text=selectedClaimant.ClaimCnt;
                    empInfoID.setStatus();
                    empInfoID.statusLabel.visible=false;
                    empInfoID.Input_ClaimCnt.text=selectedClaimant.ClaimCnt;

                    selClaimantPanel.title=selectedClaimant.FName + " " + selectedClaimant.LName + " Claim # " + selectedClaimant.ClaimNum;
                    claimantTabNav.selectedIndex = 0;

                    compClaimantInfoID.setStatus();
                    }


                    Thanks again for the help!!!

                    Have an Ordinary Day...
                    KomputerMan ~|:-)
                    • 7. Re: TypeError: Error #1009:
                      FlightGuy Level 1
                      Does your DataGrid remain visible when you change status? If you try commenting out the state change altogether, do you still get the error? Is there anything else that changes the visibility of the DataGrid when then event happens?

                      Tim
                      • 8. Re: TypeError: Error #1009:
                        KomputerMan.com Level 1
                        I have two methods of changing state for this application. One is if I click a persons name in the datagrid. The other method is if I push a button to add a new person to the database. Weird thing is if I push the Add New Person button first (which changes state to the same state as if I selected a person from the datagrid with different defaults set), then return to the starting state, then select something off of the datagrid I do not get an error.

                        If I comment out the call to change states I get the error every time I select anything in the datagrid, unless I click on the Add New Person button and then return to the initial state. Finally I have moved the call to change states from the component itself to the actionscript I posted in my prior messages, to the mx tag that calls in the custom component. It doesn't seem to matter where the change state is called from except in the number of lines returned in the error message. One constant though it is always the mouse handler function that fails.

                        Bottom line is I am beginning to believe that it is something to do with the datagrid itself. The reason I say this is because if I comment out the change state I still get the error message. Might be time to submit this error to the Adobe support people that I subscribe to.

                        Have an Ordinary Day...
                        KomputerMan ~|:-)
                        • 9. Re: TypeError: Error #1009:
                          KomputerMan.com Level 1
                          I have two methods of changing state for this application. One is if I click a persons name in the datagrid. The other method is if I push a button to add a new person to the database. Weird thing is if I push the Add New Person button first (which changes state to the same state as if I selected a person from the datagrid with different defaults set), then return to the starting state, then select something off of the datagrid I do not get an error.

                          If I comment out the call to change states I get the error every time I select anything in the datagrid, unless I click on the Add New Person button and then return to the initial state. Finally I have moved the call to change states from the component itself to the actionscript I posted in my prior messages, to the mx tag that calls in the custom component. It doesn't seem to matter where the change state is called from except in the number of lines returned in the error message. One constant though it is always the mouse handler function that fails.

                          Bottom line is I am beginning to believe that it is something to do with the datagrid itself. The reason I say this is because if I comment out the change state I still get the error message. Might be time to submit this error to the Adobe support people that I subscribe to.

                          Have an Ordinary Day...
                          KomputerMan ~|:-)
                          • 10. Re: TypeError: Error #1009:
                            FlightGuy Level 1
                            Does sound fishy and if you have a support subscription it's probably a good time to exercise it. It sounds to me like there's something with an <mx:AddChild> in you state that you're referencing before it's been created. When you go to that state and the return, the child does not get destroyed, but rather just removed from the parent. Maybe you've done so already, but if not, I suggest you have a look at all the mx:AddChild instances in the target state, and then look through your code for any references to their id's.

                            Tim
                            • 11. Re: TypeError: Error #1009:
                              Dr Khaled
                              Hi

                              An advice to all of you: Search the forum before you put your question.

                              The answer is done by before by peterent as follows:

                              When you have a navigation container like TabNavigator, Flex normally creates the components for the container's first child. The rest of the components for the container's remaining children are not created until you reveal them. This is known as the creationPolicy with the default setting of "auto".

                              To do what you want, set creationPolicy="all" on the TabNavigator.

                              Best regards

                              Dr. Khaled