Actionscript 3: Reference to Stage is Null

While writing a custom Class in Actionscript 3 today I came across an issue that took me a little bit to figure out where the compile error was coming from. I was getting the wonderful error:

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

After a bit of troubleshooting I discovered that a reference to the stage in my Class was returning null. Continue reading…