A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Type Error #1009

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Location
    Rhode Island
    Posts
    5

    Type Error #1009

    I'm using CS4 and AS3

    I am getting no compile errors in my code, but in the output window, I keep receiving the following:

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

    This prompt appears before I click on the button that is supposed to run the movie clip, so it appears that it is not the problem.

    Can anyone tell me what I am doing wrong? I am working with buttons and movie clips; all of my objects are display objects or display containers, so I have no idea what the reference to a null object is.
    I have not created any custom classes for this, and don't think I would have to for such a simple project.

    Rick

  2. #2
    Member
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    74
    In your Actionscript code, did you try to access a DisplayObject that doesn't exist on Stage? Without any code, it's hard to guess the problem.
    My DeviantART gallery of drawings and games.

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Location
    Rhode Island
    Posts
    5
    Thanks for the response. I'm not sure posting the code would help because the code I'm writing is timeline based. I am pretty sure I am not referencing an object that isn't on the timeline. In usage, all my assets have at least one usage count.
    I've also tried data typing all my clips and buttons, but that doesn't seem to make a difference.
    An earlier version of this part of my project is working perfectly; only when try to incorporate it into the larger file am I getting stuck with the dreaded #1009

  4. #4
    Member
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    74
    There's two common pitfalls I can think of, that I always end up making.

    Check your instance names. Whether you spelled them correctly or had given them one in the first place. Having an asset usage count as seen according to the library, is useless if Actionscript is referencing the wrong instance name.

    Check whether you are referencing an object that doesn't exist on the timeline yet. For example button_mc exists only from the 3rd frame onwards, but you start referencing it on frame 1 on your timeline code. That would give you a null reference.

    This is only on the display side of things though. Hope this helps anyway. =)
    My DeviantART gallery of drawings and games.

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Location
    Rhode Island
    Posts
    5

    Problem Solved

    Thanks, cardin:

    I have solved the problem. It appears I was using a corrupted file. the button I used was causing the null object reference.

    When I replaced it with a button from another version the code executed and my trace statements appeared in the output window.
    Thanks you for your help!!

    Rick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center