Skip to main content
Known Participant
August 21, 2013
Question

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

  • August 21, 2013
  • 1 reply
  • 440 views

I've had this error plenty of times, but for the life of me I can't figure out this one. I have a very long Air file. I have a function that keeps giving me this 1009 error. Well sort of. I call other functions within this one that give me the problem. Lets say I have function1, and within it I have calls to function 2 and function 3 and function 4. I'll first comment everything out and function 1 doesn't return the 1009 error. Then I'll uncomment function 2, but then I get the 1009 error from function 2. So then I comment out function 2 out and uncomment function 3. Then the 1009 error goes to function 3. Same thing with function 4. Clearly I'm missing something because the code works in another shorter file that I used for testing. Does anyone have any idea why the 1009 error would propagate from one function to another?

This topic has been closed for replies.

1 reply

Known Participant
August 22, 2013

Figured it out. I have a lot of code and I don't use classes so I separate my code with many layers all on frame 1. I also define variables on each layer which turned out to be the problem. Once my code got complicated enough or something this practice didn't work and certain variable definitions weren't made. Once I put all my variables at the top of the first layer of action script my problems went away. Never ran into this problem before. The problem did come about after I started connecting to an Air database. Maybe that slowed things down or changed something. Problem solved.