If you are writing a flex app, you might get this error
TypeError: Error #1009: Cannot access a property or method of a null object reference. if you do, it simply means that you are trying to do something with an object that hasn’t yet been created. If that object is the stage, then you are probably calling an init funtion on creationComplete. If you change this to applicationComplete, you’ll have the stage present.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();" ... >