Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I debug Error #1009?

Explorer ,
Jan 30, 2013 Jan 30, 2013

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, .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, .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()[acolyte68New_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"

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 30, 2013 Jan 30, 2013

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, .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1, saturation:1}, ease:Sine.easeOut});
        }


}

}

Translate
Community Expert ,
Jan 30, 2013 Jan 30, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 30, 2013 Jan 30, 2013

1428 corresponds to this:

for (var i in IntroIMGS_COLLAGE.AppsIntro)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2013 Jan 30, 2013

IntroIMGS_COLLAGE doesn't exist when that code executes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 30, 2013 Jan 30, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 30, 2013 Jan 30, 2013

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_tl.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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2013 Jan 30, 2013
LATEST

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, .5, {alpha: 1, blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{colorize:0x000000, amount:0, brightness:1, saturation:1}, ease:Sine.easeOut});
        }


}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 30, 2013 Jan 30, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines