13 Replies Latest reply on Jan 6, 2019 4:13 PM by Robert Mc Dowell

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

    Kimlau1989 Level 1

      It always warn me this message.

       

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

      at MethodInfo-9()

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

      at MethodInfo-12()

       

      mycode is here:

       

      var count:Number = 0;
      var objectoriginalX3:Number;
      var objectoriginalY3:Number;

      this.stop();

      date.buttonMode = true;
      date.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
      date.addEventListener(MouseEvent.MOUSE_UP, dropObject3);

      authorQ3.buttonMode = true;
      authorQ3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
      authorQ3.addEventListener(MouseEvent.MOUSE_UP, dropObject3);

      titleQ3.buttonMode = true;
      titleQ3.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
      titleQ3.addEventListener(MouseEvent.MOUSE_UP, dropObject3);

      publication.buttonMode = true;
      publication.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject3);
      publication.addEventListener(MouseEvent.MOUSE_UP, dropObject3);


      function pickupObject3(event:MouseEvent):void {
      event.target.startDrag(true);
      event.target.parent.addChild(event.target);
      objectoriginalX3 = event.target.x;
      objectoriginalY3 = event.target.y;
      }

      function dropObject3(event:MouseEvent):void {
      event.target.stopDrag();
      var matchingTargetName:String = "target" + event.target.name;
      var matchingTarget:DisplayObject = getChildByName(matchingTargetName);
        if (event.target.dropTarget != null && event.target.dropTarget.parent == matchingTarget){
        event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
        event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
        event.target.buttonMode = false;
        event.target.x = matchingTarget.x;
        event.target.y = matchingTarget.y;
       
        response_mc.gotoAndStop(1);
        nextquestion.gotoAndStop(1);
       
        count++;
        if (count==4){
         response_mc.gotoAndStop(2);
         nextquestion.gotoAndStop(2);
         nextquestion.addEventListener(MouseEvent.CLICK, question3);
         function question3(event:MouseEvent):void{
          gotoAndStop(4);
          date.gotoAndStop(2);
          authorQ3.gotoAndStop(2);
          titleQ3.gotoAndStop(2);
          publication.gotoAndStop(2);
         
          response_mc.gotoAndStop(1);
          nextquestion.gotoAndStop(1);
         }
        }
       
       
      } else {
        event.target.x = objectoriginalX3;
        event.target.y = objectoriginalY3;
        }

      }

        • 1. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
          bhargavi reddy Level 1

          Once try to debug the program. You can get the line number where the error is. And trace the objects in that line, you can easily find out the null object.

           

          For debug the program, go to Debug -> Debug Movie -> in Flash Professional.

          • 2. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
            Kimlau1989 Level 1

            var score:Number = 0;
            var objectoriginalX2:Number;
            var objectoriginalY2:Number;

            this.stop();

            author.buttonMode = true;
            author.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject2);
            author.addEventListener(MouseEvent.MOUSE_UP, dropObject2);

            doi.buttonMode = true;
            doi.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject2);
            doi.addEventListener(MouseEvent.MOUSE_UP, dropObject2);

            year.buttonMode = true;
            year.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject2);
            year.addEventListener(MouseEvent.MOUSE_UP, dropObject2);

            page.buttonMode = true;
            page.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject2);
            page.addEventListener(MouseEvent.MOUSE_UP, dropObject2);

            volumn.buttonMode = true;
            volumn.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject2);
            volumn.addEventListener(MouseEvent.MOUSE_UP, dropObject2);

            journal.buttonMode = true;
            journal.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject2);
            journal.addEventListener(MouseEvent.MOUSE_UP, dropObject2);

            article.buttonMode = true;
            article.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject2);
            article.addEventListener(MouseEvent.MOUSE_UP, dropObject2);

            function pickupObject2(event:MouseEvent):void {
            event.target.startDrag(true);
            event.target.parent.addChild(event.target);
            objectoriginalX2 = event.target.x;
            objectoriginalY2 = event.target.y;
            }

            function dropObject2(event:MouseEvent):void {
            event.target.stopDrag();
            var matchingTargetName:String = "target" + event.target.name;
            var matchingTarget:DisplayObject = getChildByName(matchingTargetName);
            if (event.target.dropTarget != null && event.target.dropTarget.parent == matchingTarget){
              event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
              event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
              event.target.buttonMode = false;
              event.target.x = matchingTarget.x;
              event.target.y = matchingTarget.y;
             
              response_mc.gotoAndStop(1);
              nextquestion.gotoAndStop(1);
             
              score++
              if ( score==7){
               response_mc.gotoAndStop(2);
               nextquestion.gotoAndStop(2);
               nextquestion.addEventListener(MouseEvent.CLICK, question2);
               function question2(event:MouseEvent):void{
                gotoAndStop(3);
                page.gotoAndStop(2);
                volumn.gotoAndStop(2);
                article.gotoAndStop(2);
                journal.gotoAndStop(2);
                year.gotoAndStop(2);
                author.gotoAndStop(2);
                doi.gotoAndStop(2);
               }
               }
             

            } else {
              event.target.x = objectoriginalX2;
              event.target.y = objectoriginalY2;
            }

               
            }

             

            I use the debug to track.

            it warns me that this code has error  page.gotoAndStop(2);
            but I don't know what is the error.

            • 3. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
              bhargavi reddy Level 1

              Now you have to check page object whether it is having frame 2 init or not.

              • 4. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                Kimlau1989 Level 1

                It has frame2. all the objects have frame2. But debug warns all the objects such as page,volumn,article,journal,year,author,doi

                • 5. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                  Ned Murphy Adobe Community Professional & MVP

                  Do all of those objects exist in frame 3  (gotoAndStop(3);) ?  If not, you might try moving the gotoAndPlay(3) line after all the others.

                  1 person found this helpful
                  • 6. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                    Cubs Win Remington

                    Hello Ned,

                    I am also having the same issue.  TypeError: Error #1009: Cannot access a property or method of a null object reference.

                     

                     

                    There is only one text field on the stage of the "CountDown" Scene which the following code is from.  I have verified the instance name matches.

                     

                    The object of this is to show a countdown and then to go to the next scene to start playing the game.

                     

                     

                     

                    import flash.utils.Timer;

                    import flash.events.TimerEvent;

                     

                     

                    var countDownTimer:Timer = new Timer(1000);

                    countDownTimer.addEventListener(TimerEvent.TIMER, updateTimer);

                    countDownTimer.start();

                     

                     

                    var s:int = 5;

                     

                     

                    function updateTimer(event:TimerEvent):void{

                     

                    var secondsCount:String = new String(s);

                     

                     

                     

                     

                    var time1:String = secondsCount;

                     

                     

                    time_txt.text = secondsCount;

                     

                     

                    if(s >= 0){

                              s--;

                              }

                     

                     

                    if(s <= 0){

                              gotoAndStop(1,"Game");

                              }

                     

                     

                     

                     

                    }

                     

                     

                    This is the full error message

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

                              at Grizzle_fla::MainTimeline/updateTimer()[Grizzle_fla.MainTimeline::frame2:17]

                              at flash.utils::Timer/_timerDispatch()

                              at flash.utils::Timer/tick()

                     

                     

                     

                    any ideas?

                    • 7. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                      Ned Murphy Adobe Community Professional & MVP

                      Whatever object is being targeted in line 17 is the focal point of the error.

                      • 8. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                        Cubs Win Remington Level 1

                        FOUND IT!!

                        Come to find out that I needed to remove the listener and stop the timer once the clock gets to zero.  Basically once it went to the next stage, the clock was still ticking and it couldn't find the instance on the stage anymore.  I may be wrong on the reasoning but thats the only thing I could think of that I hadn't already tried.

                          Guess I just needed to sleep on it.

                        • 10. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                          vasilis_74

                          i have the same problem when i install some mods in a game.. i can send you pics and the log . https://prntscr.com/m3vdq7https://prntscr.com/m3ve14https://prntscr.com/m3ve3b , and the log file..

                          2019-01-07 01:39:33: [X:000] Loading swf mods:

                          2019-01-07 01:39:33: [X:001]   xvm_lobby/as_lobby/xvm_lobby.swf

                          2019-01-07 01:39:34: [L:002] onLibLoaded: ../../res_mods/mods/xfw_packages/xvm_lobby/as_lobby/xvm_lobby.swf

                          2019-01-07 01:39:34: [L:003] [XVM:LOBBY] processView: login

                          2019-01-07 01:39:34: [L:004] TypeError: Error #1009: Cannot access a property or method of a null object reference.

                          at com.xvm.lobby.online::OnlineLoginXvmView/init()[/var/lib/jenkins/workspace/xvm_default-6V VDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby/online; OnlineLoginXvmView.as:54]

                          at com.xfw.infrastructure::XfwViewBase/onAfterPopulate()[/var/lib/jenkins/workspace/xvm_defa ult-6VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby/o nline;OnlineLoginXvmView.as:39]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/i nfrastructure;XfwModBase.as:137]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_app;com/xvm/infrastructure ;XvmModBase.as:19]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby;LobbyX vmMod.as:69]

                          at com.xfw.infrastructure::XfwModBase/postInit()[/var/lib/jenkins/workspace/xvm_default-6VVD BJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/infr astructure;XfwModBase.as:90]

                          at com.xfw.infrastructure::XfwModBase/init()[/var/lib/jenkins/workspace/xvm_default-6VVDBJWQ U4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/infrastr ucture;XfwModBase.as:68]

                          at com.xfw.infrastructure::XfwModBase/_onAddedToStage()[/var/lib/jenkins/workspace/xvm_defau lt-6VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/x fw/infrastructure;XfwModBase.as:60]

                          at com.xfw::XfwComponent/onLibLoaded()[/var/lib/jenkins/workspace/xvm_default-6VVDBJWQU4BI5D OIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw;XfwComponent.a s:202]

                          at net.wg.infrastructure.managers.impl::LoaderManager/onLibrariesLoaderLoadedHandler()

                          at net.wg.infrastructure.managers.impl::LibrariesLoader/onLoaderInfoInitHandler()

                          at scaleform.clik.core::UIComponent/draw()

                          at scaleform.clik.core::UIComponent/draw()

                          at scaleform.clik.core::UIComponent/validateNow()

                          at scaleform.clik.core::UIComponent/handleEnterFrameValidation()

                          2019-01-07 01:39:34: [L:005] TypeError: Error #1009: Cannot access a property or method of a null object reference.

                          at com.xvm.lobby.ping::PingLoginXvmView/init()[/var/lib/jenkins/workspace/xvm_default-6VVDBJ WQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby/ping;PingLo ginXvmView.as:54]

                          at com.xfw.infrastructure::XfwViewBase/onAfterPopulate()[/var/lib/jenkins/workspace/xvm_defa ult-6VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby/p ing;PingLoginXvmView.as:39]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/i nfrastructure;XfwModBase.as:137]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_app;com/xvm/infrastructure ;XvmModBase.as:19]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby;LobbyX vmMod.as:69]

                          at com.xfw.infrastructure::XfwModBase/postInit()[/var/lib/jenkins/workspace/xvm_default-6VVD BJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/infr astructure;XfwModBase.as:90]

                          at com.xfw.infrastructure::XfwModBase/init()[/var/lib/jenkins/workspace/xvm_default-6VVDBJWQ U4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/infrastr ucture;XfwModBase.as:68]

                          at com.xfw.infrastructure::XfwModBase/_onAddedToStage()[/var/lib/jenkins/workspace/xvm_defau lt-6VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/x fw/infrastructure;XfwModBase.as:60]

                          at com.xfw::XfwComponent/onLibLoaded()[/var/lib/jenkins/workspace/xvm_default-6VVDBJWQU4BI5D OIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw;XfwComponent.a s:202]

                          at net.wg.infrastructure.managers.impl::LoaderManager/onLibrariesLoaderLoadedHandler()

                          at net.wg.infrastructure.managers.impl::LibrariesLoader/onLoaderInfoInitHandler()

                          at scaleform.clik.core::UIComponent/draw()

                          at scaleform.clik.core::UIComponent/draw()

                          at scaleform.clik.core::UIComponent/validateNow()

                          at scaleform.clik.core::UIComponent/handleEnterFrameValidation()

                          2019-01-07 01:39:34: [L:006] TypeError: Error #1009: Cannot access a property or method of a null object reference.

                          at com.xvm.lobby.widgets::WidgetsBaseXvmView/init()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby/widget s;WidgetsLoginXvmView.as:24]

                          at com.xfw.infrastructure::XfwViewBase/onAfterPopulate()[/var/lib/jenkins/workspace/xvm_defa ult-6VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby/w idgets;WidgetsBaseXvmView.as:39]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/i nfrastructure;XfwModBase.as:137]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_app;com/xvm/infrastructure ;XvmModBase.as:19]

                          at com.xfw.infrastructure::XfwModBase/processView()[/var/lib/jenkins/workspace/xvm_default-6 VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xvm/xvm_lobby;com/xvm/lobby;LobbyX vmMod.as:69]

                          at com.xfw.infrastructure::XfwModBase/postInit()[/var/lib/jenkins/workspace/xvm_default-6VVD BJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/infr astructure;XfwModBase.as:90]

                          at com.xfw.infrastructure::XfwModBase/init()[/var/lib/jenkins/workspace/xvm_default-6VVDBJWQ U4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw/infrastr ucture;XfwModBase.as:68]

                          at com.xfw.infrastructure::XfwModBase/_onAddedToStage()[/var/lib/jenkins/workspace/xvm_defau lt-6VVDBJWQU4BI5DOIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/x fw/infrastructure;XfwModBase.as:60]

                          at com.xfw::XfwComponent/onLibLoaded()[/var/lib/jenkins/workspace/xvm_default-6VVDBJWQU4BI5D OIOXE2NT3DUPFLZQVJ2EHAAQHRHFSKLIGYD5UA/src/xfw/src/actionscript/xfw;com/xfw;XfwComponent.a s:202]

                          at net.wg.infrastructure.managers.impl::LoaderManager/onLibrariesLoaderLoadedHandler()

                          at net.wg.infrastructure.managers.impl::LibrariesLoader/onLoaderInfoInitHandler()

                          at scaleform.clik.core::UIComponent/draw()

                          at scaleform.clik.core::UIComponent/draw()

                          • 11. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                            Robert Mc Dowell Level 4

                            This thread is 5 years old, please delete your comment and open a new issue.

                            BTW error #1009 has nothing to do with Flash but with the developers who programmed your game,

                            it's a typical error saying that a NULL variable is called with a property which is a code issue.

                            Contact the developers of the game.

                            • 12. Re: What is TypeError: Error #1009: Cannot access a property or method of a null object reference.
                              vasilis_74 Level 1

                              ty very much for your help.. i must content ot the developers of the game or the creators of the mod?