7 Replies Latest reply: Jan 30, 2013 3:38 PM by kglad RSS

    How do I debug Error #1009?

    nikolaig Community Member

      I have var for all the mc's in one larger mc. This var allows me to apply MOUSE_OVER/OUT effect at once to all the mc's inside larger mc.

      Everything works. Only on a click which brings a user to another set of pages I have this error (which I find strange since this set up has nothing to do with a click):

       

      IntroIMGS_COLLAGE.AppsIntro.addEventListener(MouseEvent.MOUSE_OVER, navOver_ORIGINAL_IntroIMGS_COLLAGE);
      IntroIMGS_COLLAGE.AppsIntro.addEventListener(MouseEvent.MOUSE_OUT, navOut_ORIGINAL_IntroIMGS_COLLAGE);
      
      
      function navOver_ORIGINAL_IntroIMGS_COLLAGE(e:MouseEvent):void
      {
          //loop through all icons
          for (var i in IntroIMGS_COLLAGE.AppsIntro)
              {
              //tween out all icons
              TweenMax.to(IntroIMGS_COLLAGE.AppsIntro[i], .2, {alpha:.85, blurFilter:{blurX:1, blurY:1}, colorMatrixFilter:{colorize:0x000000, amount:0.25, brightness:0.65, saturation:0.7}, ease:Sine.easeOut});
              }
              //target = tween the icon you are over to its normal state
              TweenMax.to(e.target, .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1.25, saturation:1}, ease:Sine.easeOut});
      }
      
      
      function navOut_ORIGINAL_IntroIMGS_COLLAGE(e:MouseEvent):void
      {
          for (var i in IntroIMGS_COLLAGE.AppsIntro)
              {
              //tween out all icons to a normal state
              TweenMax.to(IntroIMGS_COLLAGE.AppsIntro[i], .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1, saturation:1}, ease:Sine.easeOut});
              }
      }
      

       

      Here is the error message in the Output panel:

       

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

          at acolyte68New_OpeningCollage_fla::mainsite_mc_2/navOut_ORIGINAL_IntroIMGS_COLLAGE()[acolyt e68New_OpeningCollage_fla.mainsite_mc_2::frame1:1428]

       

      I tested in a way that I replaced "IntroIMGS_COLLAGE.AppsIntro" with "IntroIMGS_COLLAGE" - then it all worked.

       

      All array of mc's is inside the "AppsIntro" which is inside of "IntroIMGS_COLLAGE"

        • 1. Re: How do I debug Error #1009?
          kglad CommunityMVP

          the problematic line number should follow the colon.  what is 14 28?

          • 2. Re: How do I debug Error #1009?
            nikolaig Community Member

            1428 corresponds to this:

            for (var i in IntroIMGS_COLLAGE.AppsIntro)
            • 3. Re: How do I debug Error #1009?
              moccamaximum Community Member

              In my experience a lot of simple navigation problems, result in failing to understand the difference between

               

              MOUSE_OVER and ROLL_OVER

               

              and

               

              event.target and event.currentTarget.

               

              In most circumstances , especially when you have multiple nested Objects you will go for a combination of  ROLL_OVER + event.currentTarget and also set objects mouseEnabled property to false, if you don`t want them to mess with your events.

              • 4. Re: How do I debug Error #1009?
                kglad CommunityMVP

                IntroIMGS_COLLAGE doesn't exist when that code executes.

                • 5. Re: How do I debug Error #1009?
                  nikolaig Community Member

                  but it is physically there. how can I make it sure that it does exists when the code executes?

                  • 6. Re: How do I debug Error #1009?
                    nikolaig Community Member

                    This was the code for the button which navigated out of the set of frames with "IntroIMGS_COLLAGE.AppsIntro"

                     

                    IntroIMGS_COLLAGE.AppsIntro.coolingreflectionsIntro_btn.addEventListener(MouseEvent.CLICK, CoolingReflectionsIntro_PopUp);

                     

                    function CoolingReflectionsIntro_PopUp(event:MouseEvent): void {

                        sourceVar_AppPopUpsLoader_fromPrdcts="images/app_images/original/coolingreflections_new_t l.swf";

                        gotoAndPlay("appPopUps_fromPrdcts");

                    }

                     

                    I believe the MOUSE_OVER was still active because the mouse is still over an mc which was just clicked, therefore it is trying to impelment the function but the navigation already moved out of the set of frames with the specified function (because of the click).

                    I decided to disable this function on click and it seemed to work:

                    //disabling navOut_ORIGINAL_IntroIMGS_COLLAGE by removeEventListener

                    IntroIMGS_COLLAGE.AppsIntro.removeEventListener(MouseEvent.MOUSE_OUT, navOut_ORIGINAL_IntroIMGS_COLLAGE);

                     

                    Please let me know if it is a right way to do things or other method/s would be more preferable?

                     

                     

                    • 7. Re: How do I debug Error #1009?
                      kglad CommunityMVP

                      this works in more situations:

                       

                      function navOut_ORIGINAL_IntroIMGS_COLLAGE(e:MouseEvent):void
                      {

                      if(IntrolIMGS_COLLAGE){
                          for (var i in IntroIMGS_COLLAGE.AppsIntro)
                              {
                              //tween out all icons to a normal state
                              TweenMax.to(IntroIMGS_COLLAGE.AppsIntro[i], .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1, saturation:1}, ease:Sine.easeOut});
                              }


                      }

                      }