Skip navigation
kwalijkje
Currently Being Moderated

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

Mar 27, 2011 6:06 AM

I've designed a wesbite for a friend in Flash, having never used the programme for anything before other than an image sequencer for animation. The website is here http://my-jordan.org/

 

When I run the swf file on my computer it seems to work fine, every button, every animation runs smoothly. When I use the test movie option in Flash it still runs fine, but I get this error stack when I click the Contact button.

 

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

     at MyJordanAgain_fla::MainTimeline/frame35()

     at flash.display::MovieClip/gotoAndStop()

     at MyJordanAgain_fla::MainTimeline/contactBtnClick()

 

Here's the script relating to it:

 

{

     contactBtn.addEventListener(MouseEvent.CLICK,contactBtnClick);

function contactBtnClick(m:MouseEvent):void

{

     homeBtn.visible=true;

     dinnerAtHomeBtn.visible=true;

     activitiesBtn.visible=true;

     sightsBtn.visible=true;

     sampleItinBtn.visible=true;

     contactBtn.visible=true;

     enterBtn.visible=false;

     upBtn1.visible=false;

     downBtn1.visible=false;

     petraBtn.visible=false;

     madabaBtn.visible=false;

     karakBtn.visible=false;

     shobakBtn.visible=false;

     ajlounBtn.visible=false;

     wadirumBtn.visible=false;

     ammanBtn.visible=false;

     jerashBtn.visible=false;

     gotoAndStop("contactPage");

}

}

And here's the only sript to be found on frame 35:

stop();

 

sampleItinScroll.scrollTarget = sampleItinTxt;

 

I don't know what the error stack is trying to tell me. Help.

 

I also put the website up despite the error, because the swf worked fine. But as you can see, the website breaks down and stops working at the Sights button. I assume this is also something to do with the unsolved error...

 

Thank you very much for any help you can give.

 
Replies
  • Currently Being Moderated
    Mar 27, 2011 6:42 AM   in reply to kwalijkje

    The second line of code you show for frame 35 would be the most suspect due to the nature of the 1009 error.

     

    The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
     
    - is not in the display list
    - doesn't have an instance name (or the instance name is mispelled)
    - does not exist in the frame where that code is trying to talk to it
    - is animated into place but is not assigned instance names in every keyframe for it
    - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
     
    If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you confirm which line is involved.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2011 8:09 AM   in reply to kwalijkje

    I can't tell much without knowing more about what isn't running properly.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2011 10:08 AM   in reply to kwalijkje

    The code doesn't look wrong, though it doesn't explain anything about how the design is done, so there's really no telling at this point what the problem might be.  You might try using currentLabel instead of currentFrameLabel unless you know for sure that you can only be in the frame that has that label when you test for it.

     

    The fact that your Sights page controls seem to exist in parallel with the other sections of the site has me wondering just what you have laid out along your timeline.  If you can show a screenshot of that and explain how the design is intended to work that could help lead to solving something.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2011 12:11 PM   in reply to kwalijkje

    It's got me confused, so here's what I can offer... take your sights sections and make it a movieclip in itself, containing its up/down buttons, such that it only occupies one frame of the main timeline.  That way, you can keep those buttons from telling the main timeline to travel elsewhere, which is what is somehow happening.  Your up/down buttons can work solely within the sights movieclip and cannot then possibly appear in other sections of the site.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points